I have the following JSON ("name" has more members only showing "cinema" here for simplicity)
{
"name": {
"cinema": {
"size": {
"w": 256,
"h": 200
},
"frame": {
"x": 0,
"y": 0,
"w": 256,
"h": 200
}
}
}
}
Which has been parsed using JSON.parse and stored in the varable bts_json. I want to loop through each member of "name" and detect if it has the member "frame". Below is my code, I get nothing printed on the console.
buildingNames = bts_json.name;
for (buildingFrame in buildingNames) {
if (buildingFrame.hasOwnProperty("frame")) {
console.log('exists');
console.log(buildingFrame["frame"]["y"]);
}
}
Where am I going wrong?
Thanks for helping :)
varin thatfor...instatement.for (var buildingFrame in buildingNames) {