Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does jQuery have built in full support for JSON2?

Tags:

json

jquery

I need to know is JSON2 lib included in jQuery core or must i use JSON2 lib from http://www.json.org/js.html.

like image 765
jmav Avatar asked Oct 19 '09 07:10

jmav


People also ask

What is parseJSON in jQuery?

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 -

What does the JSON parse () method do when we initiate an Ajax request?

Description: Takes a well-formed JSON string and returns the resulting JavaScript value.


2 Answers

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.

like image 131
Alex Sexton Avatar answered Sep 16 '22 11:09

Alex Sexton


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...

like image 27
Christian C. Salvadó Avatar answered Sep 18 '22 11:09

Christian C. Salvadó