如何在 Apache Nifi 的结尾和开头删除 json 文件中的括号

how to remove the Brackets in a json file at the end and beginning in Apache Nifi

我有一个像下面这样的 json 文件并尝试删除数组开头和结尾的括号

[
  {
    "a": "1",
    "b": "2"
  }
]

我只想要地图:

{
  "a": "1",
  "b": "2"
}

有人知道要使用哪个处理器以及如何配置吗? 谢谢,卢卡斯

您可以使用 SplitJson 处理器。

我对处理器使用了以下设置。

或者您也可以使用 EvaluateJsonPath。这是我对 EvaluateJsonPath 的配置。

另一种方法可能是添加 JoltTransformJSON 处理器,它将包含此规范

[
  {
    "operation": "shift",
    "spec": {
      "*": ""
    }
  }
]