nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Lim <Keith....@ds-iq.com>
Subject Re: How to extract scalar info of json array using EvaluateJsonPath processor?
Date Thu, 12 May 2016 21:52:47 GMT
Hi Aldrin,

I am still not able to get this to work.  I see that the expression language guide (http://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html)
mentions how to work with flowfile attributes, but not on the flowfile content itself.  What
is the builtin variable that points to the flowfile content that I can used with the expression
language?

For illustration, let's say I have the below json as the content of a flowfile.  What processor
can I used to take this flowfile as input and how can I extract the count of item in the json
array "results" below.  I want to assign it to a user defined attribute in the processor.

{ "results" :  [   {  "name" : "Jane Doe",  "id" : "1" },   {  "name" : "John Doe", "id" :
"2" }  ] }

Thanks for all your help.

Thanks,
keith
________________________________
From: Aldrin Piri <aldrinpiri@gmail.com>
Sent: Thursday, May 12, 2016 1:32 PM
To: users@nifi.apache.org
Subject: Re: How to extract scalar info of json array using EvaluateJsonPath processor?

Hi Keith,

Scanning over some of the docs, it does not appear that JsonPath supports a count operator
but could possibly be used to extract from your source document that could possibly be manipulated
using something like allDelinatedValues [1].  Certainly not the most elegant approach, but
could work.

If you would like some additional help, a sample to work from would be nice to give some more
concrete assistance.

[1] http://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#alldelineatedvalues

On Thu, May 12, 2016 at 11:52 AM, Keith Lim <Keith.Lim@ds-iq.com<mailto:Keith.Lim@ds-iq.com>>
wrote:
I have a flow file with json array and would like to use EvaluateJsonPath processor the extract
the item count of that array.  Does the Nifi Expression Language in combination of json path
feature supports this without writing script?  What is the syntax?

Thanks,
Keith




Mime
View raw message