Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to evalute Attribute (Json format)

avatar
Contributor

How to Evaluate attribute (output of Invoke Http which is in JSON format)

mohdriyaz_0-1711781753325.png

This attribute value contain a Json in the following format 

 {

    location : { FileSource :  "X" ,  URL : "Y"}

From this attribute value (Json), I need to extract File Source and URL and put it into another attribute with the same name.

Note : Flow file Content should remain as it is.

Any Pointer ..??

1 ACCEPTED SOLUTION

avatar
Contributor

I got the Solution.

Use UpdateAttribute processor and Expression Language. 

mohdriyaz_0-1712214695029.png

Here "SignedURL" is the attribute (containing complex Json) and from that I fetch particular Key value using Expression Language (JSONPATH) 

 

View solution in original post

3 REPLIES 3

avatar
Expert Contributor

Hi @mohdriyaz,

You can achive this by using following steps.

 

saquibsk_0-1712023469788.png

 

Step1: In GenertateFlow I took your input

 

saquibsk_1-1712023515147.png

Step2: Use EvaluateJsonPath and set the Destination as Flowfile-attribute and write the JSON Path

saquibsk_2-1712023607772.png

 

Step3: Use UpdateAttribute in case of further modification.

output:

saquibsk_3-1712023657706.png

 

------------

If you found any of the suggestions/solutions provided helped you with your issue, please take a moment to login and click "Accept as Solution" on one or more of them that helped.

avatar
Contributor

@saquibsk 

Thanks for Reply. 

Solution you have provided will work with content of flow file and not with the attribute.  EvaluateJsonPath is use to evaluate the JSON present in flow file content. 

In my case , I have JSON present as attribute and not as content of flow file.

avatar
Contributor

I got the Solution.

Use UpdateAttribute processor and Expression Language. 

mohdriyaz_0-1712214695029.png

Here "SignedURL" is the attribute (containing complex Json) and from that I fetch particular Key value using Expression Language (JSONPATH)