以下是我的输入:
{ "isPoolPoint": "test", "timeZone": "ET" }
我希望输出为:
{ "address" : [{"line2": "test"}] }
如果isPoolPoint
是一个null
,我不应该得到任何东西作为输出。
发布于 2018-08-03 04:01:59
等级库
[
{
"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"
}
}
}
}
]
发布于 2021-08-06 10:18:48
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"
}
}
}
}
]
https://stackoverflow.com/questions/51609993
复制相似问题