Javascript jquery 等效于 JSON.stringify
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11118947/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jquery equivalent for JSON.stringify
提问by Highmastdon
Possible Duplicate:
Serializing to JSON in jQuery
可能的重复:
在 jQuery 中序列化为 JSON
I'm using jquery as a library in my javascript code. But sometimes I have to JSON.stringify()
.
我在我的 javascript 代码中使用 jquery 作为库。但有时我不得不这样做JSON.stringify()
。
When I want to keep my code IE compatible I use $("head").append('<script type="text/javascript" src="../Includes/json2.js"></script>');
to get my JSON.stringify()
to work. Isn't there a equivalent in jquery
for JSON.stringify()
?
当我想保持我的代码与 IE 兼容时,我$("head").append('<script type="text/javascript" src="../Includes/json2.js"></script>');
用来让我JSON.stringify()
的工作。没有等价的jquery
forJSON.stringify()
吗?
回答by Mariusz Jamro
There is no such functionality in jQuery. Use JSON.stringify
or alternatively any jQuery plugin with similar functionality (e.g jquery-json).
jQuery 中没有这样的功能。使用JSON.stringify
或替代任何具有类似功能的 jQuery 插件(例如jquery-json)。