Nested JSON with Recursive Function in Simple JavaScript



Nested JSON with Recursive Function in Simple JavaScript

Code :
let data = [
{
“name” : “Azhar”,
“job” : “Youtuber”,
“location” : {
“city” : “Kolkata”,
“state” : “WB”
}
},
{
“name” : “Arun”,
“job” : “SE”,
“city” : “Bangalore”,
“state” : “Karnataka”
},
{
“name” : “Mr.Beast”,
“job” : “YouTuber”,
“location”:{
“address” : {
“city” : “NewYork”,
“state” : “US”
}
}
}
]

function recursive(obj){
for(prop in obj){
if(typeof(obj[prop])== “object”){
recursive(obj[prop])
} else {
if(prop == “name” || prop == “job” || prop == “city”){
console.log(prop+” : “+obj[prop])
}
}
}
}

data.filter(item= {
recursive(item)
})

Chapters:
0:00 – Introduction to the video.
0:23 – Forming a Nested Json
3:31 – Program for retrieving desired result in Nested JSON with Recursive Function
7:57 – End tags and subscription to the channel

My second Channel:
WrestleTalkByAzhar – https://www.youtube.com/c/wrestleTalkByAzhar

Follow Insta:
https://www.instagram.com/kingazharjamal/
https://www.instagram.com/fari_digi/

One Card App Link to Apply:
https://1cardapp.page.link/88LF

Cred App Link to Apply:
https://app.cred.club/spQx/ud86uunq

Next Steps :

———————————————————————————————————————————————————
———————————————————————————————————————————————————
Must Watch Playlists

► 1. Javascript – https://youtube.com/playlist?list=PLO2l2fYgN805CokP5kaOWOhqP3-2vyXdS
► 2. Puppetter – https://youtube.com/playlist?list=PLO2l2fYgN805E5fbSnvtFM3K9c92ePS8e
► 3. Cypress – https://youtube.com/playlist?list=PLO2l2fYgN807KRpLfvvrqa1MSX8XdYxkV
► 4. Tech works – https://www.youtube.com/watch?v=ZNAdt4Oe5Sw&list=PLO2l2fYgN807CQ5H3ER__7x7LeEA10T2Z
► 5. Vbscript Basics To Advanced – https://www.youtube.com/watch?v=z_ctZDolyG0&list=PLO2l2fYgN805CuD-90ESrxRqX__-YJMym
► 6. Jmeter – https://youtube.com/playlist?list=PLO2l2fYgN806eNr5cr-TMTX8xGTW7Mtcn
► 7. Excel – https://youtube.com/playlist?list=PLO2l2fYgN806piZ2fD0bYNi3ExoPJlcqj
► 8. Appium – https://www.youtube.com/playlist?list=PLO2l2fYgN806V_9-wL-dpmrGg8dhPPONK
► 9. Shares – https://youtube.com/playlist?list=PLO2l2fYgN806ySmKp3sskJW0ByJalmPE2
► 10. Javascript Interview Questions -https://youtube.com/playlist?list=PLO2l2fYgN807uZl7Mp7ESavluzVU25ux9
► 11. C# Tutorials – https://www.youtube.com/playlist?list=PLO2l2fYgN805Dct9KbYNYC8nGOzwKjklt
► 12. HTML & CSS – https://www.youtube.com/playlist?list=PLO2l2fYgN804tkFuKw9DlcVXT0m8hDzdw
► 13. Browser Console – https://www.youtube.com/playlist?list=PLO2l2fYgN80692hfTP1BcgmWNBZV0ZYzo
► 14. JSON – https://www.youtube.com/playlist?list=PLO2l2fYgN8062RQNrQt5xAQZFaFINvMsY
► 15. Specflow – https://www.youtube.com/playlist?list=PLO2l2fYgN806s2KXmhI6eqHLwP_sriPl0
► 16. MongoDB – https://www.youtube.com/playlist?list=PLO2l2fYgN80626nl1UkUz3ufXSlgMXIkh
► 17. Postman – https://youtube.com/playlist?list=PLO2l2fYgN804Nf9Vfma54yFNwlA3bF9-Z
► 18. Python – https://youtube.com/playlist?list=PLO2l2fYgN80486BcimGYi9Y3XQ-beQHCN
———————————————————————————————————————————————————
———————————————————————————————————————————————————
#json
#nested
#javascript

Comments are closed.