- 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 extract json array using EvaluateJsonPath processor in NiFi?
- Labels:
-
Apache NiFi
Created ‎02-28-2021 07:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have json flowfile, [{"prediction":"Test2"},{"prediction":"Test2"}].
I am want extract the 1st part of the array ie prediction":"Test2 my destination is flowfile-attribute using EvaluateJsonPath .
I have added a custom attribute mlresult --->$.prediction[0], to extract the "Test2" into mlresult, but I am getting empty string for the mlresults for the flow file attribute section.
flow file : [{"prediction":"Test2"},{"prediction":"Test2"}]
EvaluateJsonPath configuration:
How to get the value(only one) Test2 to mlresult?
Thanks
--Murali
Created ‎02-28-2021 10:23 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here are two possible solutions.
At solution 1 the value is set into an array.
At solution 2 I took the flowfile-content (json) and set it into an attribute. Then you can work with expression language to get the value.
For testing the syntax I recommend this site:
http://jsonpath.herokuapp.com/
Created ‎02-28-2021 10:23 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here are two possible solutions.
At solution 1 the value is set into an array.
At solution 2 I took the flowfile-content (json) and set it into an attribute. Then you can work with expression language to get the value.
For testing the syntax I recommend this site:
http://jsonpath.herokuapp.com/
