- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to evalute Attribute (Json format)
- Labels:
-
Apache NiFi
Created on ‎03-30-2024 12:00 AM - edited ‎03-30-2024 12:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to Evaluate attribute (output of Invoke Http which is in JSON format)
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 ..??
Created ‎04-04-2024 12:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I got the Solution.
Use UpdateAttribute processor and Expression Language.
Here "SignedURL" is the attribute (containing complex Json) and from that I fetch particular Key value using Expression Language (JSONPATH)
Created on ‎04-01-2024 07:08 PM - edited ‎04-01-2024 07:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @mohdriyaz,
You can achive this by using following steps.
Step1: In GenertateFlow I took your input
Step2: Use EvaluateJsonPath and set the Destination as Flowfile-attribute and write the JSON Path
Step3: Use UpdateAttribute in case of further modification.
output:
------------
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.
Created on ‎04-04-2024 12:08 AM - edited ‎04-04-2024 12:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created ‎04-04-2024 12:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I got the Solution.
Use UpdateAttribute processor and Expression Language.
Here "SignedURL" is the attribute (containing complex Json) and from that I fetch particular Key value using Expression Language (JSONPATH)
