How could I parse through this JSON object in JQuery?
This question already has an answer here:
Your JSON is not valid.
Once you create a valid JSON string, parsing it is very simple.
Use the following steps:
jQuery.parseJSON()
on the text Here's a working fiddle.
It does something like this:
var jsonText = '[ { "cid": "3", "pid": "0", "nid"...} ]';
var jo = $.parseJSON(jsonText);
If you have the JSON in string form, you can use JSON.parse
[MDN] to get it in object form, and then do with it what you need to.
Modern browsers have this function natively - no jQuery necessary - but you can also include it yourself from one of these locations:
For a more complete list, see JSON.org.
链接地址: http://www.djcxy.com/p/8492.html