I have json message in this format
{"id":21,"image":"binary64image","pdate":"2014-01-27"},
{"id":22,"image":"binary64image","pdate":"2014-01-27"},
{"id":21,"image":"binary64image","pdate":"2014-01-27"}
and I want to convert this into javascript array, I have tried
var txt = '{ "potholes" : [' + data + ']}';
var jsonObj = eval("(" + txt + ")");
alert(jsonObj.potholes[1].id);
and
var potholes = JSON.parse(data);
alert(potholes[1].id);
neither worked. The data is there as it is in a success to an ajax call which returns json object.
console.log(data)? An array? A string?