shi*_*kou 30
您可能想要查看:http: //www.json.org/js.html
ste*_*ewe 26
您可以使用"Closure Library"(Google)制作跨浏览器的JSON编码器/解码器.
只需访问http://closure-compiler.appspot.com/
并在文本字段中插入以下内容,然后点击"编译":
// ==ClosureCompiler==
// @compilation_level ADVANCED_OPTIMIZATIONS
// @output_file_name default.js
// @use_closure_library true
// ==/ClosureCompiler==
goog.require('goog.json');
if (!window['JSON']) window['JSON']={};
if (typeof window['JSON']['stringify'] !== 'function') window['JSON']['stringify']=goog.json.serialize;
if (typeof window['JSON']['parse'] !== 'function') window['JSON']['parse']=goog.json.parse;
Run Code Online (Sandbox Code Playgroud)
Gab*_*oli 14
jQuery本身可以解码JSON字符串jQuery.parseJSON()
.
但是对于编码,我只知道一个插件:jquery-json