I would like to merge two different json in nifi. first json comes from an attribute to json processor and contains just an id, something like:
{
"id": "1234"
}
second one is a json of this structure:
[
{"id1": "1234","id2": "1234","id3": "1234"},
{"id1": "1234","id2": "1234","id3": "1234"},
{"id1": "1234","id2": "1234","id3": "1234"},
{"id1": "1234","id2": "1234","id3": "1234"}
]
desired result should be something like:
{
"id": "1234",
"data": [
{"id1": "1234","id2": "1234","id3": "1234"},
{"id1": "1234","id2": "1234","id3": "1234"},
{"id1": "1234","id2": "1234","id3": "1234"},
{"id1": "1234","id2": "1234","id3": "1234"}
]
}
how can I make it? I was trying merge content to concatenate those two json flowfiles having this result:
[
{
"id": "1233"
},
[
{
"id1": "1234",
"id2": "1234",
"id3": "1234"
},
{
"id1": "1234",
"id2": "1234",
"id3": "1234"
},
{
"id1": "1234",
"id2": "1234",
"id3": "1234"
},
{
"id1": "1234",
"id2": "1234",
"id3": "1234"
}
]
]
now, I think I need a Jolt transform (or maybe something else ?!?) but I don't know which are the parameters of the transformation...