json数据:
[{"toyCode":"","toyName":"name1","manufacturer_id":0,"toyType":0,"macAddr":"8C705AF44EC4","isSelected":0},
{"toyCode":"","toyName":"name2","manufacturer_id":0,"toyType":0,"macAddr":"8C705AF89EC4","isSelected":0},
{"toyCode":"","toyName":"name3","manufacturer_id":0,"toyType":0,"macAddr":"8C705AF90EC4","isSelected":0},
{"toyCode":"","toyName":"name4","manufacturer_id":0,"toyType":0,"macAddr":"8C705AF20EC4","isSelected":0},
{"toyCode":"","toyName":"name5","manufacturer_id":0,"toyType":0,"macAddr":"8C705AF09EC4","isSelected":0}]
遍历
var json = eval(response.string);//response.string 得到的就是顶部的json数据
alert(json);
for(var i=0; i<json.length; i++)
{
alert(json[i].toyName+" " + json[i].macAddr) ;
}
js中遍历json
最新推荐文章于 2022-09-27 16:55:34 发布