I searched for this topic, and I can't seem to find the right way to parse the JSON string to read the objects.
Here is my code
$.getJSON("<url>",
function(data) {
alert("success!"+data);
});
outputs:
success![object Object],[object Object],[object Object],[object Object]
Firebug shows correct response, and when I click JSON tab I see all the objects.
Thanks!
$.getJSON
. If you want to see the original string, just do a$.get()
request instead. Then you can dovar parsed = $.parseJSON(data)
to get it parsed. (I assume this is jQuery code.)for/in
loop, or you need to have pre-determined knowledge of their content. If for some reason you don't know what the keys are, then use$.get()
and look at the string. Or, instead ofalert(data)
, doconsole.log(data)
and open your browser's console. This will let you inspect the content.