Nested JSON Objects | How to Iterate over the JSON Object and its Children Objects in Javascript

preview_player
Показать описание
Code :

{
"Animals":{
"cat": {
"humanFriendly": [
"Yes"
]
},
"tiger": {
"humanFriendly": [
"No"
]
},
"chettah": {
"humanFriendly": [
"No"
]
},
"lion": {
"humanFriendly": [
"No"
]
},
"jaguar": {
"humanFriendly": [
"No"
]
},
"dog": {
"humanFriendly": [
"Yes",
"No"
]

}
}
}

Program :

var typeOfAnimals = jsonObject["Animals"]
value = "lion"
function animalsJson(json,value){
for (index in json){
var obj = json[index]
if(value == index){
break;
}
}
}

animalsJson(typeOfAnimals,value)

Next Steps :

---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
Must Watch Playlists

---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------

#nestedJSONobjects
#readJSONObjects
#javascript
Рекомендации по теме
Комментарии
Автор

Extraordinary bro keep going it's simple and easy trick try to use to acheive same with inbuilt function like filter out map....

marimuthur
visit shbcf.ru