javascript - divide json on 2 arrays -
i try divide json array:
var json = [{"date":"23","count":"100"},{"date":"23","count":"100"}] var labels = [],data=[]; for(var in json){ labels.push(json[i].date); data.push(json[i].count); } alert(labels);
but in alert ,
problem ? there https://jsfiddle.net/90597hzy/
json not have date
& count
key
replaced name & label. working expected
var json = [{"name":"23","label":"100"}, {"name":"23","label":"100"}] var labels = [],data=[]; for(var in json){ labels.push(json[i].name); data.push(json[i].label); } console.log(labels);
Comments
Post a Comment