I'm having a problem with finding an array or list size using Stefan Goessner's JsonPath. I'm using the version json-path-2.0.0.
My jsonpath expression is $.orders.length and JSON looks something like this:
{
  "orders" : [
    ...
  ]
}Its failing with the following error:
com.jayway.jsonpath.PathNotFoundException: Property ['length'] not found in path $['orders']
And I tried with $.orders.length() too which is again failing with the below error:
com.jayway.jsonpath.PathNotFoundException: Property ['length()'] not found in path $['orders']
Please suggest me how to get the length of the array using Goessner's JsonPath expression.
[EDIT] Following is how I'm obtaining the configuration:
    com.jayway.jsonpath.Configuration conf = com.jayway.jsonpath.Configuration.defaultConfiguration().addOptions(Option.DEFAULT_PATH_LEAF_TO_NULL);
    DocumentContext documentContext = JsonPath.using(conf).parse(orderJson);
    Object val = documentContext.read(jsonPathExpression);
 
     
     
     
     
     
    