首页 > 解决方案 > 如何仅在 JOLT 中的字段不为空时进行映射

问题描述

这是我的输入:

   { "isPoolPoint": "test", "timeZone": "ET" }

我希望输出为:

   { "address" : [{"line2": "test"}] }

isPoolPoint如果是 a ,我不应该得到任何输出null

标签: jolt

解决方案


规格

[
  {
    "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"
        }
      }
    }
  }
]

推荐阅读