Struggling today to figure out how to loop through and print the name of each object.
Check out the JSON response below:
{
"placeListings": {
"OBJ1": {
"Active": true,
"Name": "place 1"
},
"OBJ2": {
"Active": true,
"Name": "place 2"
},
"OBJ3": {
"Active": true,
"Name": "place 3"
}
}
}
I want to extract the names using a for loop
for (let i = 0; i < res.length; i++) {
console.log("NAME: " + res.placeListings.OBJ1.Name);
}
However, I'm unsure how to go through OBJ1/OBJ2/OBJ3 etc...
If you have any guidance, please share!