Hi there,
I'm trying to filter a JSON array based on items that are nested in the structure.
Wondering if there is a way that requires less steps than what I've come up with:

So the "ForEach" steps through every customer in my array and filters the Value-field within the ProductInterests (Choice-field from a SP list). Then a compose checks if the field is empty. If not empty, then append to variable.
Wondering if it is possible to skip the condition check and use an if-statement instead (but couldn't find a formula that appends to the array-variable).
Also wondering if there is a way to do this without an ForEach-Loop at all, just with code.
This is the JSON:
{
"body": {
"value": [
{
"ID": 1,
"Name": "Good Deals",
"Adress": "Some Street\nSome City",
"Active": true,
"ContactPersons": [
{
"DisplayName": "Peter",
"Email": "Peter@GoodDeals.com"
},
{
"DisplayName": "Nina",
"Email": "Nina@GoodDeals.com"
}
],
"ProductInterests": [
{
"Id": 1,
"Value": "Bikes"
},
{
"Id": 2,
"Value": "Boats"
}
],
"ProductInterests#Id": [1, 2],
"CompanySize": {
"Id": 1,
"Value": "51-100"
},
"CompanySize#Id": 1
},
{
"ID": 2,
"Name": "Fun Factory",
"Adress": "Some street\nSome city",
"Active": false,
"ContactPersons": [
{
"DisplayName": "Juan",
"Email": "Juan@FunFactory.com"
}
],
"ProductInterests": [
{
"Id": 0,
"Value": "Cars"
},
{
"Id": 1,
"Value": "Bikes"
}
],
"ProductInterests#Id": [0, 1],
"CompanySize": {
"Id": 0,
"Value": "1-50"
},
"CompanySize#Id": 0
}
]
}
}