I am writing Jolt Specification in Apache NiFi and got stuck with filtering JSON array.
I have an input like:
{
"blacklisted": ["A", "B", "F"],
"items": [
{"name": "A", "data": 1},
{"name": "B", "data": 3},
{"name": "C", "data": 4},
{"name": "D", "data": 7}
]
}
I need a result to be:
{
"items":[
{"name": "C", "data": 4},
{"name": "D", "data": 7}
]
}
Is it possible to filter data with JOLT Transform for this case? Can you please help me with the jolt spec?
Another option is to get output like:
{
"blacklisted": ["A", "B", "F"],
"items": [
{"name": "A", "data": 1, "blacklisted": true},
{"name": "B", "data": 3, "blacklisted": true},
{"name": "C", "data": 4, "blacklisted": false},
{"name": "D", "data": 7, "blacklisted": false}
]
}
You can use successive shift transformation specs such as
in order to get