Possible Duplicate:
Loop through Json object
{ "data": [ { "name": "Jen", "id": "1" }, { "name": "Steve", "id": "8" } ] } A server I'm interacting with responds with the above.
I'm trying to loop through itenter code here for the For..in statement.
This is what I'm trying to do:
for (var item in response.data) { console.log(item.name); } This doesn't work. What went wrong?
Thank you
I GOT IT to work with the following after reading the comment:
for (var item in response.data) { console.log(response.data[item].name); } I was able to get a list of names...
Can someone dissect the response as to why it worked?