With a JSON object as below, is it possible to filter only IOS related content? I'm open to any method, i.e. a for-in loop or .filter?
For example I would want to filter so that I return content only when the platform key is a match for "IOS", in which case I would get:
- Title 1
- question 1b
- IOS
The difficulty is that the title should only be printed if the platform match is successful, and I can't see a way of achieving this with a regular nested for in loop.
[
{
"title": "Title 1",
"faqs": [
{
"question": "question 1a",
"platform": "ANDROID"
},
{
"question": "question 1b",
"platform": "IOS"
}
]
},
{
"title": "Title 2",
"faqs": [
{
"question": "question 2a",
"platform": "ANDROID"
},
{
"question": "question 2b",
"platform": "WEB"
}
]
}
]