I have read other issues regarding accessing a json array in javascript, but nothing helped in my case. I am receiving the below json in jquery ajax call.
{"jList":"[{\"added_by\":\"Ani\",\"description\":\"example description.\",\"start_date
\":\"2014-10-10\",\"mark\":255,\"id\":975},{\"added_by\":\"Ani\",\"description
\":\"example description..\",\"start_date\":\"2014-10-10\",\"mark\":255,\"id\":980
}]"}
receiving method-
$.getJSON("url",
{var : Val},
function(data){
here...
All I want is to count the JSON objects in this array. In the above case I want an length output as 2 but I'm not getting it. I have tried below things-
data.jList.length-- < giving 200 like something as outputObject.keys(data).length-- < giving 200 like something as outputObject.keys(data['jList']).length-- < giving 1 as output
How do I get 2 as length output of the above array?
console.log(theVariable);to see what it contains.