Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

nested json array

function arrayConvert(json){
    var arr = [];
    for(index in json){
        var obj = json[index];
        var key = null;
        while(typeof obj == 'object'){
            for(ind in obj){
                if(key == null) key = ind;
                obj = obj[ind];
            }
        }
        arr.push({'key':key, 'val':obj});
    }
    return arr;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #nested #json #array
ADD COMMENT
Topic
Name
6+3 =