Re: Approaches to Array in Json with Nifi?

2016-04-07 Thread Aldrin Piri
Hong, Koji, There is a ticket to upgrade this processor to a new version [1] (although the ticket is showing its age by listing 2.1.0). I had looked into changing it, but the structure of the library validation process and visibility of some of the core classes changed a fair amount and was break

Re: Approaches to Array in Json with Nifi?

2016-04-07 Thread Koji Kawamura
Hi all, I got interested in EvaluateJsonPath, too. So I tried to figure out how to do that, and found there're few obstacles now. Input Json = {"company":"xyz", "rate":[0.02, 0.03, 0.04]} Then, applying following JsonPaths return: $.rate.min() => 0.2 $.rate.length() => 3 $.rate.avg() => 0.03 T

Re: Approaches to Array in Json with Nifi?

2016-04-06 Thread Hong Li
Sorry, Aldrin. I forgot to answer your question. My arrays do not share fixed number of values. Thanks. Hong *Hong Li* *Centric Consulting* *In Balance* (888) 781-7567 office (614) 296-7644 mobile www.centricconsulting.com | @Centric On Wed, Apr 6, 2016 at 4:3

Re: Approaches to Array in Json with Nifi?

2016-04-06 Thread Hong Li
I have two goals here for the information embedded in the array. The first goal is to be able to do some kind of aggregation on the array. For example, given {"company":"xyz", "rate":[0.02, 0.03, 0.04]}, if we could have a Json variable "rate", I would like to have something such as ${rate[*]:coun

Re: Approaches to Array in Json with Nifi?

2016-04-06 Thread Thad Guidry
​Does it store as an attribute if you change the return type from auto-detect to JSON ? *Return Type* auto-detect - auto-detect - json - scalar Indicates the desired return type of the JSON Path expressions. Selecting 'auto-detect' will set the return type to 'json' for a Destination o

Re: Approaches to Array in Json with Nifi?

2016-04-06 Thread Aldrin Piri
Hi Hong! What are you seeking to do with the rate data after extracting? Is the number of rates fixed? If not, not sure there is an easy path forward with just EvaluateJsonPath to make this happen. I am wondering if SplitJson might be appropriate to use as a follow-on, but could use some more c

Re: Approaches to Array in Json with Nifi?

2016-04-06 Thread Hong Li
The issue I run into there is when I specify under EvaluationJsonPath, firstRateValue = $.rate[0] $.rate[0] is a scalar value that is assigned to the processor property firstRateValue, which is also a scalar. But $.rate[*] is an array or vector. Nifi will send error there and the process will f

Re: Approaches to Array in Json with Nifi?

2016-04-06 Thread Thad Guidry
$.rate[*] sorry, forget to tell you your answer. Thad +ThadGuidry

Re: Approaches to Array in Json with Nifi?

2016-04-06 Thread Thad Guidry
Internally it uses Jayway JsonPath (which is a port of Stefan Goessner's JsonPath) There are many JsonPath online tests for you to use. My preferred that does realtime updates as you type is http://www.jsonquerytool.com/ Thad +ThadGuidry On Wed, Apr 6, 2016

Approaches to Array in Json with Nifi?

2016-04-06 Thread Hong Li
Let's say we have object and array in Json as {"company":"xyz", "rate":[0.02, 0.03, 0.04]} With Nifi processor EvaluateJsonPath, we may get the individual values of the object and array such as companyValue = $.company firstRateValue = $.rate[0] What would you recommend if I need to capture a