nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aldrin Piri <>
Subject Re: Parse JSON issue
Date Thu, 01 Oct 2015 18:21:06 GMT
In this case, with your expression, you are saying select all children of
the root (objects) and select their "values".  This works out to be a
nested array and is what you are seeing in the exception.

What you are looking for is something more along the lines of:

Select the first element in my root array, select its values, and then give
me one item from it.

On Thu, Oct 1, 2015 at 2:03 PM, Christopher Wilson <>

> I'm collecting some performance data from collectd and have a pipeline
> built with collectd -> Kafka -> NiFi where I intend to route the samples
> based on some rules and the format of those samples.
> The payload of the collectd samples is like the JSON below (and I've not
> prettified it) and I'm having issues parsing out any of the values.  I've
> used sites like to try a few
> JsonPath expressions but am not successful.  Current value I'm trying is
> '$..values'.
> [{"values":[0.11,0.11,0.09],"dstypes":["gauge","gauge","gauge"],"dsnames":["shortterm","midterm","longterm"],"time":1443721390.389,"interval":30.000,"host":"my-virtual-machine","plugin":"load","plugin_instance":"","type":"load","type_instance":""}]
> I think part of the issue is that 'values', as an example, is an array of
> several values and the error (below) says "Unable to return scalar value".
> True - as you can see, but even when I have single value it's stored in an
> array element.  Nothing out there leads me to believe this is invalid JSON
> either (JSONLint, etc) and it looks like the processor is adding and extra
> '[' in the expression.
> EvaluateJsonPath[id=3aef1ef7-b1b2-438d-a958-0228138a9ff8] Unable to return
> a scalar value for the expression $..['values'] for FlowFile 1735438.
> Evaluated value was [[74424320]]. Transferring to failure.
> Thoughts?
> -Chris

View raw message