'{"result":true,"count":1}'
这时候,我们要读取里面的result或count,就需要把字符串转成对象: 转换方法:
1,
var json = '{"result":true,"count":1}';obj = JSON && JSON.parse(json) || $.parseJSON(json);alert(obj.result);alert(obj.count);
2.
var strJSON = '{"result":true,"count":1}';var objJSON = eval("(function(){return " + strJSON + ";})()");alert(objJSON.result);alert(objJSON.count);
来自: