JS遍历Json字符串中键值对先转成JSON对象再遍历
1、将Json字符串转换成JSON对象
var t='{"firstName": "cyra", "lastName": "richardson"}'; var obj = eval('(' + t + ')');
2、遍历读取键值对
for(var str in obj){ alert(str+'='+obj[str]); }
相关推荐
ghjcduhvfyjhbf 2016-01-18
ghjcduhvfyjhbf 2015-10-13
只争朝夕 2014-08-12
Anything 2014-03-30
疯狂的扣子 2013-10-30
sjunothing 2013-07-30
疯狂的扣子 2012-06-12
疯狂的扣子 2012-04-23
Anything 2011-11-05
yigeng 2011-07-12
天天无用 2011-03-29
zxiaocun 2011-07-12
文明 2019-05-08
文明 2016-04-06
duxd 2019-04-29
JING 2013-10-29
sailxu00 2019-04-14