JSON对象到字符串

Jam*_*ore 14 jquery json

如何获取JSON对象并将其转换回原始字符串格式?

谢谢

roc*_*hal 14

你可以使用一个优秀的json2.js库:https: //github.com/douglascrockford/JSON-js

看看JSON.stringify方法.

编辑:

似乎librabry现在转移到github repo:https://github.com/douglascrockford/JSON-js


Sil*_*ter 5

使用Douglas Crockford的JSON对象的stringify方法:

http://www.json.org/js.html

这将在警告框中显示您的对象:

alert(JSON.stringify(myObject));
Run Code Online (Sandbox Code Playgroud)