Given: an array
[
{
"name": "home page",
"title": "Find Jobs in Technology",
"url": "https://www.url1.com/",
"elements": [
{
"category": "navigation",
"buttons": [
{
"title": "Tech Careers",
"type": "DropDown",
"options": [
{
"title": "Job Search",
"type": "Button",
"navigation": true
},
{
"title": "Career Events",
"type": "Button",
"navigation": false
}
]
},
{
"title": "Insights",
"type": "Link",
"navigation": true
}
]
}
]
},
{
"name": "tech careers",
"title": "careers",
"url": "https://www.url1.com/careers",
"elements": [
{
"category": "navigation",
"buttons": [
{
"title": "Login",
"type": "Link",
"navigation": true
}
]
}
]
}
]
I would like to filter this array using Javascript to get an array of objects with "navigation": true.
Expected filtered array:
[
{
"title": "Job Search",
"type": "Button",
"navigation": true
},
{
"title": "Insights",
"type": "Link",
"navigation": true
},
{
"title": "Login",
"type": "Link",
"navigation": true
}
]
Thanks in advance.
I tried array.filter, but it works for one level of items.