Here is my input :
{ "isPoolPoint": "test", "timeZone": "ET" }
I want output to be :
{ "address" : [{"line2": "test"}] }
I should not get any thing as output if isPoolPoint
is a null
.
Here is my input :
{ "isPoolPoint": "test", "timeZone": "ET" }
I want output to be :
{ "address" : [{"line2": "test"}] }
I should not get any thing as output if isPoolPoint
is a null
.
Spec
[
{
"operation": "shift",
"spec": {
"isPoolPoint": {
// match down into the values of "isPoolPoint"
// if we match null, then do nothing
"null": null,
// match everything else
"*": {
// write what was matched to the output
"$": "address[0].line2"
}
}
}
}
]
I wanted to ignore blank strings as well in addition to null values so I did below extra condition
[
{
"operation": "shift",
"spec": {
"isPoolPoint": {
// OR operator below will care of empty string or null
"|null": null,
"*": {
"$": "address[0].line2"
}
}
}
}
]