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

Time:09-25

i have a json file like this one below and try to remove the array's brackets at the beginning and the end

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

and i only want the map:

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

anyone knows which processor to use and how to configure? Thanks, Lukas

CodePudding user response:

You can use SplitJson Processor.

I've used the following settings for the Processor.

Configuration for SplitJson processor

Or you can also use EvaluateJsonPath. Here is my configuration for EvaluateJsonPath.

Configuration for EvaluateJsonPath processor

CodePudding user response:

An alternative way might be adding a JoltTransformJSON processor which will contain this spec

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