l rf
l rf

Reputation: 27

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

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

Upvotes: 0

Views: 954

Answers (2)

Barbaros Özhan
Barbaros Özhan

Reputation: 65323

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

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

Upvotes: 0

Rony
Rony

Reputation: 173

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

Upvotes: 2

Related Questions