var str = '{"a":"a","b":"b"}';
var jsonstr;
~(function strToJson(str){
jsonstr = (new Function("return " + str))();
// return jsonstr;
})(str);
console.log(typeof jsonstr); //object
console.log(jsonstr); //Object {a: "a", b: "b"}
缥缈止盈
相关分类