Original Question:
jQuery makes a point of not including a publicly accessible JSON parser or encoder. They want you to use a 3rd party library for that.
I recommend the one hosted at json.org:
https://github.com/douglascrockford/JSON-js/blob/master/json2.js
Alternatively, you could use the jQuery-JSON plugin hosted on Google Code:
http://code.google.com/p/jquery-json/
In answer to "why doesn't jQuery make it's parser available?":
jQuery doesn't actually include a parser of any sort. In the AJAX section of jQuery's codebase, you can actually see what they do on lines 572-579.
The quick version is that they actually do a check to see if you've included an external JSON library such as the one from json.org, and if it finds it, they use that to parse. If you have not included one, they return the json wrapped in a function, effectively returning it for evaluation. Very tricky, but very smart!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…