开发者

JSON stringify standalone function for JavaScript

I know of YUI who has a JSON.stringify utility and also of JSON2 from json.org.

What are other good implementations of JSON.stringify?

It should also work in IE6, IE7 and not depend on a framework.

If it depends on anything this should be easily incl开发者_运维百科uded all in one file.

Edit: I could easily use jquery-json, which was suggested in the comments of the accepted answer. It did what I wanted. (It depends on jquery but that was easily solved)


Well, I would recommend you to stay with the JSON2 library, it is really small (~2.5K minified), and it uses native implementations if available.

This small standalone library is also compatible with the JSON object described in the ECMAScript 5 Edition Standard.


Consider "json-sans-eval". I'm using this in Myna now because it is super fast, ECMAScript 5 conformant, and most importantly, unlike JSON2, it does not use eval() so there is no danger of someone abusing the JSON spec to execute trojan JavaScript code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜