I need to know is JSON2 lib included in jQuery core or must i use JSON2 lib from http://www.json.org/js.html.
The jQuery parseJSON() method takes a JSON string and returns a JavaScript object. The specified JSON string must follow the strict JSON format. Passing an incorrect string will cause a JS exception. Some of the examples of malformed JSON strings that can cause an exception on passing are given as follows -
Description: Takes a well-formed JSON string and returns the resulting JavaScript value.
It is not included in the current jQuery core (1.3.2). In the jquery irc #jquery on freenode, there is a quote by John Resig:
John Resig: "In the meantime PLEASE start migrating your JSON-using applications over to Crockford's json2.js"
Future versions of jQuery are planned to support this natively.
JSON2 is not included on the jQuery Core, but if you are wanting to use jQuery to get JSON responses from your server (by using $.getJSON, and other Ajax functions with dataType = "json") jQuery will evaluate the JSON for you, you don't need anything more.
If you need other things, like stringifying objects or parsing JSON strings on your own, you will need the JSON2 library...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With