Hi, you're mixing up simple amd jsonpath which is not a function within simple.
Your when statement can be written as .when().jsonpath("$..books.length() == 1") Take a look at the sample here https://camel.apache.org/components/latest/jsonpath-language.html BR Maruan > I am parsing an json and verify array length like below > > from("direct:parseJson") > .setHeader("numberOfBooks").jsonpath("$..books.length()", int.class) > .choice() > .when( simple("${header.numberOfBooks} == '1'")) > .log("One book") > .otherwise() > .log("multiple"); > > Above Code works, but i am looking for option if we can avoid line 2 with > below > > .when( simple("${jsonpath(' $..books.length() ', int.class)} == 1") ) > > its throwing error > > Caused by: > org.apache.camel.language.simple.types.SimpleIllegalSyntaxException: > Unknown function: jsonpath(' $..books.length() ', int.class) == 1 at > location 0 > ${jsonpath(' $..books.length() ', int.class)} == 1 --