NiFi 中的 JoltTransformJSON 处理器

JoltTransformJSON processor in NiFi

输入:

{ "table": [{
            "_id": {
              "personId": 1234,
              "customer": 345,
              "locale": "en"
          }} ] }

需要这种格式的输出,我的 Jolt 规格应该是什么

{
"table": [{
          "personId": 1234,
          "customer": 345,
          "locale": "en"
}]
}

试试下面的例子:

[
  {
    "operation": "shift",
    "spec": {
      "table": {
        // table items
        "*": {
          // internal object in item under "_id" key
          "*": "table[]"
        }
      }
    }
  }
]

我找到了解决方案。

[
  {
    "operation": "shift",
    "spec": {
      "*": {
        "*": {
          "_id": {
            "personId": "table[&2].personId",
            "customer": "table[&2].customer",
            "locale": "table[&2].locale"
          }
        }
      }
    }
  }
]