Reputation: 189
I want to update an attribute in a JSON file with the value i get from other processor. Below is my Original JSON file.
{
"applicant": {
"applicant-id": null
"full-name": "Tyrion Lannister",
"mobile-number" : "8435739739",
"email-id" : "[email protected]"
},
"product": {
"product-category" : "Credit Card",
"product-type" : "Super Value Card - Titanium"
}
}
Below is my EvaluavateJsonPath Config where I extracted the applicant-id attribute.
Below is my GenerateFlowFile processor which generate an id value.
Now I need the update the applicant-id attribute with the value (899872120) in the Original JSON as below.
{
"applicant": {
"applicant-id": 899872120
"full-name": "Tyrion Lannister",
"mobile-number" : "8435739739",
"email-id" : "[email protected]"
},
"product": {
"product-category" : "Credit Card",
"product-type" : "Super Value Card - Titanium"
}
}
I tried to use MergeContent to merge the 2 flows and i can see the Applicant-Id attribute value in the flow file after the MergeContent processor. I tried using UpdateAttribue to update Applicant-Id but i'm not able get the update JSON record.
Below is my MergeContent Configuration.
Is there anything i'm missing?
Upvotes: 0
Views: 2341
Reputation: 12103
As of NiFi 1.2.0, the JoltTransformJSON processor supports NiFi Expression Language, so if you have your id value in the attribute "Applicant-id", you can use it in a Default JOLT spec:
{
"applicant": {
"applicant-id": "${Applicant-id}"
}
}
That should transform your input JSON to your desired output JSON.
Upvotes: 2