Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NiFi EvaluateJsonPath array length

I have the following JSON:

{
    "hits": {
         "hits":[]
    }
}

(Some response from ElasticSearch).

I want to use the processor EvaluateJsonPath to get the length of hits.hits.

I tried the following expression:

$.hits.hits.length

But I get the following error:

FlowFile could not find path $['hits']['hits']['length'] for attribute key hits.: (That's the end of the error).

However, when checking online with JsonEvaluate sites it seems to work.

What's wrong with my expression?

like image 792
ChikChak Avatar asked Aug 31 '26 15:08

ChikChak


1 Answers

It seems that there are different versions of JsonPath. For me, $.hits.hits.length() worked.

like image 177
ChikChak Avatar answered Sep 05 '26 18:09

ChikChak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!