vfantidou
3 years agoNew Contributor
Filter json array of objects by another json array of objects
Hello everyone,
I have a json that looks like the bellow and I want to filter the $input0 data by whatever key/values exists in $filterData in the end. The $filterData may have ID or Customer (in this example it has ID). I have tried in Mapper with filter() and in Filter Snap, I did not have any success. Can someone help or had to solve something similar?
[
{
"input0": [
{
"ID": "1",
"CUSTOMER": "a"
},
{
"ID_NUMERIC": "2",
"CUSTOMER": "b"
},
{
"ID": "1",
"CUSTOMER": "c"
},
{
"ID": "3",
"CUSTOMER": "d"
},
{
"ID": "4",
"CUSTOMER": "f"
},
{
"ID": "4",
"CUSTOMER": "b"
}
],
"filterData": [
{
"ID": "1"
},
{
"ID": "2"
}
]
}
]
The output should contain both ID and Customer values, just like the $input0 but filtered.