'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.
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"
Solution 1:[1]
There is the flattenJSON processor, which could be an option. https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.16.1/org.apache.nifi.processors.standard.FlattenJson/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mike R |

