Looking at this JSON structure:
{
"armament": {
"air_armament": [
{
"names": {
"russian_name": "R-60",
"NATO_name": "AA-8 Aphid"
},
"weight": "43.5",
"explosive_capacity": "3",
"dynamic_characteristics": {
"mach_speed": "2.7",
"range": "8",
"guidance_system": "infrared"
},
"website": "https://en.wikipedia.org/wiki/R-60_(missile)"
},
{
"names": {
"russian_name": "R-27",
"NATO_name": "AA-10 Alamo"
},
"weight": "253",
"explosive_capacity": "39",
"dynamic_characteristics": {
"mach_speed": "4.5",
"range": "80",
"guidance_system": "radar"
},
"website": "https://en.wikipedia.org/wiki/R-27_(air-to-air_missile)"
},
...
]
}
}
I have a task to extract all the NATO names from the list of air-to-surface missiles, but my current code doesn't seem to be working as expected. Here's what I've tried so far:
function loadList(jsonObj){
surfaceMissiles = jsonObj.armament.air_surface_missiles;
for (var i = 0; i < surfaceMissiles.length; i++) {
natoName = surfaceMissiles[i].names.NATO_name;
document.getElementById("result").innerHTML += natoName + "<br>";
}
}
Unfortunately, it seems like I'm unable to access the specific node I need. Can someone provide guidance on how to solve this issue and successfully retrieve the NATO names from the surface missiles in the JSON data?