Wednesday 15 January 2014

javascript - Access JSON data array element -



javascript - Access JSON data array element -

this question has reply here:

access / process (nested) objects, arrays or json 7 answers

i have next json data:

{ "data": [ { "count": 1194, "time_bin": "2014-10-06" }, { "count": 1237, "time_bin": "2014-10-07" }, { "count": 1144, "time_bin": "2014-10-08" }, { "count": 1072, "time_bin": "2014-10-09" }, { "count": 1082, "time_bin": "2014-10-10" }, { "count": 406, "time_bin": "2014-10-11" }, { "count": 465, "time_bin": "2014-10-12" } ], "error_flag": 0, "message": "7 rows returned" }

i want access "count" separately. how can that?

maybe this?

var jsondata = { info : [ {count:1194, time_bin:"2014-10-06"}, ... ] , error_flag:0, message:"here message" }; var count; (var i=0; i<jsondata.data.length; i++){ count = jsondata.data[i].count; // }

javascript json

No comments:

Post a Comment