Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
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.