js如何解析后台传过来的json字符串

2024-11-17 13:55:27
推荐回答(2个)
回答1:

var str = '{"rows":[{"ID":0,"登录账号":"admin","登录时间":"\/Date(1446772997000)\/","登录地点":"河北石家庄","登录IP":"115.181.15.99"}]}';
var obj = eval("(" + str + ")");

console.log(obj);

回答2:

var data ="{}"; //json字符串
var obj = JSON.parse(data);
alert(obj.rows);