Created 07-28-2022 08:05 AM
Hi,
I am trying to add flow attribute from my json file which looks like:
[ {
"name" : "id",
"value" : "29879"
}, {
"name" : "file",
"value" : ""
}, {
"name" : "barcode",
"value" : ""
}, {
"name" : "roll no",
"value" : "3032"
}, {
"name" : "name",
"value" : "Daniel"
}]
Now I want to add roll no. as a flow atrribute using
Can someone please help me with it? Thanks
Created 07-28-2022 12:10 PM
Hi ,
If you want to extract the value (3032) of the name "roll no" into flowfile attribute called "roll no" you can accomplish this with two processors as follows:
1- EvaluateJsonPath:
roll no = $.[?(@.name=='roll no')].value
Make sure the Return Type is set to Json since the exrepssion above will return json ["3032"].
2- Update Attribute : which will extract the actual value from result json above with the following attribute: roll no = ${'roll no':jsonPath('$[0]')}
Also you can refer to :
If that helps, please Accept Solution. Thanks
Created 07-28-2022 12:10 PM
Hi ,
If you want to extract the value (3032) of the name "roll no" into flowfile attribute called "roll no" you can accomplish this with two processors as follows:
1- EvaluateJsonPath:
roll no = $.[?(@.name=='roll no')].value
Make sure the Return Type is set to Json since the exrepssion above will return json ["3032"].
2- Update Attribute : which will extract the actual value from result json above with the following attribute: roll no = ${'roll no':jsonPath('$[0]')}
Also you can refer to :
If that helps, please Accept Solution. Thanks
Created 07-29-2022 05:03 AM
It worked for me. Thanks.