I have this JSON as input:
{
"BusinessInfo": {
"MemberInformation": {
"Item": [
{
"Relation": {
"Item": [
{
"Partner1": "0072938063",
"Partner2": "0072938064",
"CategoryId": "BUR001"
},
{
"Partner1": "0072938063",
"Partner2": "0072937669",
"CategoryId": "ZCRM06"
},
{
"Partner1": "0072938063",
"Partner2": "3000011685",
"CategoryId": "ZCRM06"
},
{
"Partner1": "1020002423",
"Partner2": "0072938063",
"CategoryId": "ZCRM01"
},
{
"Partner1": "0072938067",
"Partner2": "0072938063",
"CategoryId": "ZCRM04"
},
{
"Partner1": "0072938063",
"Partner2": "0072937669",
"CategoryId": "ZCRM04"
},
{
"Partner1": "0072938063",
"Partner2": "0072938065",
"CategoryId": "ZCRM04"
}
]
}
}
]
}
}
}
And this Jolt spec:
[
{
"operation": "shift",
"spec": {
"BusinessInfo": {
"MemberInformation": {
"Item": {
"*": {
"Relation": {
"Item": {
"*": {
"CategoryId": {
"ZCRM04": {
"@(2,Partner1)": "[&3].Partner1",
"@(2,Partner2)": "[&3].Partner2"
}
}
}
}
}
}
}
}
}
}
}
]
Having as result, this:
[ null, null, null, null, {
"Partner1" : "0072938067",
"Partner2" : "0072938063"
}, {
"Partner1" : "0072938063",
"Partner2" : "0072937669"
}, {
"Partner1" : "0072938063",
"Partner2" : "0072938065"
} ]
The problem is with the null values generated. I need the same result but without them. I tried remove them adding this operations to the spec:
{
"operation": "default",
"spec": {
"*": "TRASH"
}
},
{
"operation": "remove",
"spec": {
"TRASH": ""
}
}
But doesn't work, the result is almost the same, only now instead of null appears "TRASH":
[ "TRASH", "TRASH", "TRASH", "TRASH", {
"Partner1" : "0072938067",
"Partner2" : "0072938063"
}, {
"Partner1" : "0072938063",
"Partner2" : "0072937669"
}, {
"Partner1" : "0072938063",
"Partner2" : "0072938065"
} ]
What could be wrong? In the first transformation or in the next two operations added. It is possible to avoid this from the first transformation?