NiFi中的JoltTransformJSON处理器

时间:2019-02-22 05:30:39

标签: json apache-nifi jolt

输入:

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

需要这种格式的输出,应该是我的Jolt Spec

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

2 个答案:

答案 0 :(得分:0)

请尝试以下示例:

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

答案 1 :(得分:0)

我能够找到解决方案。

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