json: for in loop
JavaScript
var data = {
"response" : {
"HUGHM017" : {
"FIRST_NAME" : "Matthew",
"LAST_NAME" : "Hughen"
},
"HUGHM041" : {
"FIRST_NAME" : "Michael",
"LAST_NAME" : "Hughes"
},
"HUGHM018" : {
"FIRST_NAME" : "Marie",
"LAST_NAME" : "Hughes"
}
},
"status" : {
"COUNT" : 3
}
};
var people = data.response;
for(var prop in people){
if (people.hasOwnProperty(prop)){
console.log(prop);
console.log(people[prop].FIRST_NAME);
}
}
for(let prop of people){
console.log(prop);
console.log(people[prop].FIRST_NAME);
}