jq框架下,给个示例,仅供参考:
var objs = $.parseJSON('[{"name":"aaa","age":"22"},{"name":"bbb","age":"33"}]');
var str = '';
$.each(objs, function(k, obj){
str += obj.name + ' is ' + obj.age + "\n";
});
alert(str);
var i = 0,
str = ' [{"name":"aaa","age":"22"},{"name":"bbb","age":"33"}] ',
arr = JSON.parse(str),
len = arr.length;
for (i; i < len; i++) {
console.log(arr[i].name);
console.log(arr[i].age);
}
还望采纳谢谢,如有问题请联系我