Answers for "nested json array"

11

json arrays

{
  "array": [{1,2,3,4,5,6}]
}
Posted by: Guest on June-17-2020
0

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;
}
Posted by: Guest on May-19-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language