字符串转Json

来源:互联网 发布:制作图文的软件 编辑:程序博客网 时间:2024/06/08 17:16

1、使用js函数eval();

testJson=eval(testJson);是错误的转换方式。

正确的转换方式需要加(): testJson = eval("(" + testJson + ")");

2、使用jquery.parseJSON()方法对json的格式要求比较高,必须符合json格式

jquery.parseJSON()

0 0