[b]背景[/b]:大部分浏览器已经实现了json对象转字符串的原生api支持,那在较低版本浏览器浏览器——如大家最喜爱的IE6——里如何实现呢?
首先运行以下方法,测试各种情况下,JSON.stringify的输出,这有助于下文代码的实现以及测试。用例不一定完整,欢迎补充
[url=http://tools.jb51.net/code/json]http://tools.jb51.net/code/json[/url]
JSON在线格式化工具:
[url=http://tools.jb51.net/code/jsonformat]http://tools.jb51.net/code/jsonformat[/url]
在线XML/JSON互相转换工具:
[url=http://tools.jb51.net/code/xmljson]http://tools.jb51.net/code/xmljson[/url]
json代码在线格式化/美化/压缩/编辑/转换工具:
[url=http://tools.jb51.net/code/jsoncodeformat]http://tools.jb51.net/code/jsoncodeformat[/url]
在线json压缩/转义工具:
[url=http://tools.jb51.net/code/json_yasuo_trans]http://tools.jb51.net/code/json_yasuo_trans[/url]
C语言风格/HTML/CSS/json代码格式化美化工具:
[url=http://tools.jb51.net/code/ccode_html_css_json]http://tools.jb51.net/code/ccode_html_css_json[/url]