Using
var arrayOfObjects = eval(photo.likes.data);
var objects = arrayOfObjects;
console.log(objects);
I get the code below is what console.log echos
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
]
How can I manage to show just the usernames on two lines as the javascipt I use seems to echo the 2 objects.
EDIT
$.each(likesperimage,function(index){
liked = likesperimage[index].username;
console.log(photo.id+' - '+liked);
});
I am assuming that this is a json array and you want to display the username for all the users in this array.The following code should work
here is the link to each in jquery api
http://api.jquery.com/jQuery.each/
Please test this code before using it.This is just a demonstration of how it can be done and there might be better ways to do it.