I have a JSON object:
var json = {"Mike":1, "Jake":1, "Henry":1};
I am trying to loop through this list to access the names. Currently I am using:
for (var name in json) {
if (json.hasOwnProperty(name)) {
console.log(name);
}
}
But it's not printing the name. Is that the correct way to do it?
jsFiddle: http://jsfiddle.net/bKwYq/