json字符串转成js对象我所知的方法有2种:
//json字符串转换成json对象
var str_json = "{name:'liuchuan'}"; //json字符串 //1. 函数对象构造定义
var obj1 = new Function("return " + str_json)();
console.log(obj1.name); //2. eval函数
var obj2 = eval("(" + str_json + ")"); //注意:一定要加上小括号
console.log(obj2.name);