1、将Json字符串转换成JSON对象
1
2
|
var t= '{"firstName": "cyra", "lastName": "richardson"}' ; var obj = eval( '(' + t + ')' ); |
2、遍历读取键值对
1
2
3
|
for ( var str in obj){ alert(str+ '=' +obj[str]); } |