I have below array of objects with vertical as string and projects as array of objects inside it. projects can be empty too. Each projects entry if not empty, will have name and releaseType as properties.
[
{
"vertical": "Alpha",
"projects": [
{
"name": "Test",
"releaseType": ""
}
]
},
{
"vertical": "Beta",
"projects": []
},
{
"vertical": "Gamma",
"projects": [
{
"name": "Lincoln",
"releaseType": "Google Pay"
},
{
"name": "Madison",
"releaseType": "PayPal"
}
]
}
]
I want to get the list of projects in below format. Can someone please let me know how to achieve this. This isn't regular filter method, but it requires a bit of manipulation using map. I tried few things, but I was not able to achieve expected result.
[
{
"vertical": "Alpha",
"feature": "Test",
"releaseType": ""
},
{
"vertical": "Gamma",
"feature": "Lincoln",
"releaseType": "Google Pay"
},
{
"vertical": "Gamma",
"feature": "Madison",
"releaseType": "PayPal"
}
]