Sonu
Sonu

Reputation: 77

How to Flat Nested JSON using Nifi without Using JOLT

Is there any Processor which can flatten , Nested Json Using Nifi.

I have tried using FattenJson Processor.But its not giving Expected Record.

enter image description here

Input :

{
  "header": {
    "messageId": "111"
  },
  "security": {
    "Identifier": "123~NCA~FCAD",
    "businessDate": "2022-03-07",
    "UIIdentifier": [
      {
        "sourceCode": "NA"
      },
      {
        "sourceCode": "NA-NA"
      }
    ],
    "Classification": [
      {
        "sourceCode": "aaa",
        "ClassificationCode": "ObjectType"
      }
    ]
  }
}

Output :

{
  "header.messageId": "111",
  "security.Identifier": "123~NCA~FCAD",
  "security.businessDate": "2022-03-07",
  "security.UIIdentifier": [
    {
      "sourceCode": "NA",
      "sedol1Identifier": null
    },
    {
      "sourceCode": "NA-NA"
    }
  ],
  "security.Classification": [
    {
      "sourceCode": "aaa",
      "ClassificationCode": "ObjectType"
    }
  ]
}

Expected OutPut like below:

"header.messageId": "111",
"security.Identifier": "123~NCA~FCAD",
"security.businessDate": "2022-03-07",
"security.UIIdentifier.sourceCode": "NA",
"security.UIIdentifier.sedol1Identifier": {},
"security.Classification.sourceCode": "aaa"

Upvotes: 0

Views: 95

Answers (1)

Related Questions