使用
var arrayOfObjects = eval(photo.likes.data);
var objects = arrayOfObjects;
console.log(objects);
我得到下面的代码是 console.log 的回声
json
[
Object
full_name: "marcab12"
id: "181407552"
profile_picture: "http://images.instagram.com/profiles/profile_181407550_75sq_1339521398.jpg"
username: "marcab12"
__proto__: Object
,
Object
full_name: "Ramage1992"
id: "21574723"
profile_picture: "http://images.instagram.com/profiles/profile_21574703_75sq_1349343851.jpg"
username: "ramage_1992"
__proto__: Object
]
由于我使用的 javascipt 似乎与 2 个对象相呼应,我如何才能设法在两行上显示用户名。
编辑
$.each(likesperimage,function(index){
liked = likesperimage[index].username;
console.log(photo.id+' - '+liked);
});