1.例如后台返回的json数据如下
[{'id':"1","name":"2","user":{"name":"2","age":"18"}},{'id':"2","name":"2","user":{"name":"2","age":"18"}}]
2.前台解析代码如下
var obj = eval(s);
进行格式的转化,然后就能采用点运算符去取值,如obj[0].user.name;取出结果是2
1.例如后台返回的json数据如下
[{'id':"1","name":"2","user":{"name":"2","age":"18"}},{'id':"2","name":"2","user":{"name":"2","age":"18"}}]
2.前台解析代码如下
var obj = eval(s);
进行格式的转化,然后就能采用点运算符去取值,如obj[0].user.name;取出结果是2