Reputation: 43
I am new to nifi. I need help to make new json template using jolttransform processor. could anyone please help to make joltspec for this requirement.
From convertavrotojson processor flow file am getting the following attributes
name, address, id,status
And from its content file, am getting mobileno.
Expecting the following output { "id": "1", "details":[ { "mobileno": "xxxxx", "name ": "AAAA", "address": "addressline1" } ], "status" :"true" }
Upvotes: 1
Views: 3681
Reputation: 31470
As you are having name, address, id,status attributes to the flowfile,In new versions of NiFi-1.2+ we can add attributes into json message using jolt.
Try with below jolt spec:-
[
{
"operation": "shift",
"spec": {
"mobileno": "details[0].mobileno"
}
},
{
"operation": "default",
"spec": {
"id":"${id}",
"status":"${status}",
"details[]": {
"*": {
"name":"${name}",
"address":"${address}"
}
}
}
}
]
For more reference
Upvotes: 1