I want to achieve the following JSON transformation using Jolt processor in Nifi
Input JSON
{
"topLevel": {
"secondLevelA": {
"thirdLevelA": [
{
"norsemen": "huntinSouth",
"value": "AAA"
},
{
"norsemen": "huntinNorth",
"value": "BBB"
}
]
},
"secondLevelB": {
"thirdLevelB": [
{
"norsemen": "huntinNorth",
"oddCode": "AAA301"
},
{
"norsemen": "huntinNorth",
"oddCode": "BBB701"
},
{
"norsemen": "huntinWest",
"oddCode": "AAA701"
}
]
}
}
}
Output JSON
{
"NAME": [
{
"norsemen": "huntinSouth",
"value": "AAA",
"refValue": []
},
{
"norsemen": "huntinNorth",
"value": "BBB",
"refValue": [
{
"oddCode": [
"BBB701"
]
}
]
}
]
}
I would like to test for matches between the values of secondLevelA.thirdLevelA.norsemen and secondLevelB.thirdLevelB.norsemen. If one or more matches is found, all values of secondLevelB.thirdLevelB.oddCode contained in the same set as the matching norsemen would be placed in the output in the same set as the corresponding matching norsemen.
Is there a way to do this using existing Jolt Operations?