Skip to content Skip to sidebar Skip to footer

Multidimensional Array From JSON Object

From JSON object below {cols:[{'id':'t','label':'Title','type':'string'},{'id':'l','label':'Avg ','type':'string'},{'id':'lb','label':'High','type':'string'},{'id':'lo','label':'Lo

Solution 1:

Instead of pushing a concatenated string, push an entire array to your existing array:

var arr = [];
for(var i = 0, l = json.rows.length; i < l; i++) {
    arr.push([ json.rows[i].c[0].v, json.rows[i].c[1].v ]);
}

Post a Comment for "Multidimensional Array From JSON Object"