Filter method support for camunda juel expression

I am having a json object,

{"jsonObj":{"ageArray":[{"age":25},{"age":20},{"age":26}]}}

I want only those objects from “ageArray”, whose “age” value is greater than 22, with spin camunda expression.
I am using something like

${S(jsonObj).prop("ageArray").elements().stream().filter(x->x.prop("age").value()>22)..collect(Collectors.toList())}

But I am getting a syntax error as

Error parsing '${S(jsonObj).prop("ageArray").elements().stream().filter(x->x.prop("age").value()>22)..collect(Collectors.toList())}': syntax error at position 59, encountered '>', expected <IDENTIFIER>|<STRING>|<FLOAT>|<INTEGER>|'true'|'false'|'null'|'-'|'!'|'not'|'empty'|'('

Hi @MaulinSheth98 ,

You can try below expression

jsonObj.jsonPath("$.ageArray[?(@.age > 22)]").elementList()

Querying JSON | docs.camunda.org

Thanks, @hassang for your reply.

Do we have any option, to continue with ‘S’ method, rather than ‘JSON’. I would like to use prop, elements and filter method.

As per the docs, camunda el follows juel implementation. Can we define a predicate for filter method, and collect that as list?

S and JSON can be used interchangeably.

jsonPath, is the only solution? Can we use filter method?