Gaurav Gaurav - 6 months ago 10
JSON Question

How can I iterate through following JSON object?

I have following

JSON
structure :

"123456789": {
"id": "Some_Id",
"code": "Some_Code",
"name": "Some_Name",
},
"123456789": {
"id": "Some_Id",
"code": "Some_Code",
"name": "Some_Name",
},,
"123456789": {
"id": "Some_Id",
"code": "Some_Code",
"name": "Some_Name",
}
}


Now if I have to find out name for every object inside
JSON
, how can I iterate?

Answer
Object.keys(theObject).forEach(function (key) {
  var item = theObject[key];
  console.log(item.name);
});