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