Hello, I cannot find an answer on the www to my following question. I have tried splitjson and jolttransform to achieve my desired outcome, but nothing does the trick. My input file looks like this:
{
"BVjsoBHDSI" : {
"date" : "2021-04-08",
"description" : "blabla1",
"number" : 40
},
"FudNSk" : {
"date" : "2021-09-26",
"description" : "blabla2",
"number" : 80
},
"Cfjdsl54fd" : {
"date" : "2022-05-10",
"description" : "blablubb",
"number" : 31
}
}
Actually I just want to split the stupid thing, but since the root level has a different individual value nifi doesn't understand what I want to do. The idea was to use a jolt transform to add a key "id" with the original key as value. I can't figure out a proper specification though. Glad to hear your ideas.
Desired output:
{
"BVjsoBHDSI" : {
"date" : "2021-04-08",
"description" : "blabla1",
"number" : 40,
"id" : "BVjsoBHDSI"
},
"FudNSk" : {
"date" : "2021-09-26",
"description" : "blabla2",
"number" : 80,
"id" : "FudNSk"
},
"Cfjdsl54fd" : {
"date" : "2022-05-10",
"description" : "blablubb",
"number" : 31,
"id" : "Cfjdsl54fd"
}
}
Then I could easily overwrite the root and split the flowfile as usual.