[
https://issues.apache.org/jira/browse/CAMEL-18364?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17576762#comment-17576762
]
Claus Ibsen commented on CAMEL-18364:
-------------------------------------
Can you try with json-path 2.7 release
> camel-jsonpath not working on primitives
> ----------------------------------------
>
> Key: CAMEL-18364
> URL: https://issues.apache.org/jira/browse/CAMEL-18364
> Project: Camel
> Issue Type: Bug
> Components: camel-jsch
> Affects Versions: 3.18.0
> Reporter: Luca Ferrari
> Priority: Major
>
> running the following as part of my route:
>
> {code:java}
> .marshal().json() .choice() .when().jsonpath("$[?(@.counter>0)]")
> .log("watchout");{code}
> with the following payload:
> {code:java}
> {"counter":1}{code}
> and I'm getting the below error even though the expression evaluate fine here
> [http://jsonpath.herokuapp.com/?path=$..book[2]]
>
> {code:java}
> 2022-08-08 14:00:39,074 WARN [org.apa.cam.com.jms.EndpointMessageListener]
> (Camel (camel-23) thread #20 - JmsConsumer[sensor]) Execution of JMS message
> listener failed. Caused by: [org.apache.camel.ExpressionEvaluationException -
> com.jayway.jsonpath.InvalidPathException: Filter: [?] can not be applied to
> primitives. Current context is: {'counter':1}]:
> org.apache.camel.ExpressionEvaluationException:
> com.jayway.jsonpath.InvalidPathException: Filter: [?] can not be applied to
> primitives. Current context is: {'counter':1}
> at
> org.apache.camel.jsonpath.JsonPathExpression.evaluate(JsonPathExpression.java:159)
> at
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:45)
> at
> org.apache.camel.support.ExpressionSupport.matches(ExpressionSupport.java:36)
> at
> org.apache.camel.builder.ExpressionClause.matches(ExpressionClause.java:1155)
> at
> org.apache.camel.processor.FilterProcessor.matches(FilterProcessor.java:89)
>
> {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)