Reputation: 77
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"
Upvotes: 0
Views: 95
Reputation: 589
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/
Upvotes: 1