开发者

JSON.stringify() and JSON2.stringify() difference?

开发者 https://www.devze.com 2022-12-22 12:05 出处:网络
I downloaded the JSON2.js from https://github.com/douglascrockford/JSON-js/blob/master/json2.js and it does not have implementation for JSON2.stringify()

I downloaded the JSON2.js from https://github.com/douglascrockford/JSON-js/blob/master/json2.js and it does not have implementation for JSON2.stringify()

To be able to call 开发者_高级运维a wcf service from jquery, I am using a helper class that uses JSON2.stringify()

What's the difference between the two and where do I get JSON2?


if you read the file you linked to it mentions

This file creates a global JSON object containing two methods: stringify and parse.

JSON.stringify(value, replacer, space) ...  
JSON.parse(text, reviver) ..

So the object is JSON and not JSON2 ...

[update]

I assume you use the code from this article : jQuery AJAX calls to a WCF REST Service

If you take the time to read it all, he mentions that he is using a hacked version to handle the encoding he wants.. and points to a zip file with his version .. so look at the JSON encoding section in that article..

0

精彩评论

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

关注公众号