Closed loveall closed 3 years ago
Configs has more than 3 levels?
Yes, it can be. We don't have control from downstream response.
Try with this spec
[
//first level
{
"operation": "shift",
"spec": {
"body": {
"allConfigs": {
"*": {
"configs": {
"*": {
"flagToDelete": {
"ABC_CODE8|ABC_NA|ABC_CODE6": null,
"*": {
"@2": "body.allConfigs[&5].configs[&3]"
}
}
}
}
}
},
"*": "body.&0"
}
}
},
//second level
{
"operation": "shift",
"spec": {
"body": {
"allConfigs": {
"*": {
"configs": {
"*": {
"configs": {
"*": {
"flagToDelete": {
"ABC_CODE8|ABC_NA|ABC_CODE6": null,
"*": {
"@2": "body.allConfigs[&7].configs[&5].configs[&3]"
}
}
}
}
}
}
}
},
"*": "body.&0"
}
}
},
//third level
{
"operation": "shift",
"spec": {
"body": {
"allConfigs": {
"*": {
"configs": {
"*": {
"configs": {
"*": {
"configs": {
"*": {
"flagToDelete": {
"ABC_CODE8|ABC_NA|ABC_CODE6": null,
"*": {
"@2": "body.allConfigs[&9].configs[&7].configs[&5].configs[&3]"
}
}
}
}
}
}
}
}
}
},
"*": "body.&0"
}
}
},
//remove null values in array
{
"operation": "modify-overwrite-beta",
"spec": {
"*": "=recursivelySquashNulls"
}
}
]
thanks again lucioalmeida.
how can we remove array element if flagToDelete is either ABC_CODE8 / ABC_NA / ABC_CODE6 (Basically "flagToDelete" values are dynamic and input "configs" are nested array )
Wanted to know if there is any way without custom jolt operation.
Input is :
Expected out put is :
Any suggestions are very much appreciated.