-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Description
In the 'store' example JSON, you can get a list of book prices using:
$.store.book[*].price
Or all prices:
$.store..price
What I tried to do is get the maximum price value using the max() function.
$.store..price.max()
However, this returns the error:
com.jayway.jsonpath.JsonPathException: Aggregation function attempted to calculate value using empty array
at com.jayway.jsonpath.internal.function.numeric.AbstractAggregation.invoke(AbstractAggregation.java:62)
at com.jayway.jsonpath.internal.path.FunctionPathToken.evaluate(FunctionPathToken.java:38)
at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:81)
at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:79)
at com.jayway.jsonpath.internal.path.PathToken.handleArrayIndex(PathToken.java:133)
at com.jayway.jsonpath.internal.path.WildcardPathToken.evaluate(WildcardPathToken.java:40)
at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:81)
at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:79)
at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:81)
at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:79)
at com.jayway.jsonpath.internal.path.RootPathToken.evaluate(RootPathToken.java:62)
at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:53)
at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:61)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:181)
at com.jayway.jsonpath.internal.JsonContext.read(JsonContext.java:164)
at com.jayway.jsonpath.internal.JsonContext.read(JsonContext.java:151)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:502)
Is this a bug or is this type of function usage not yet supported?
I'm using the latest from 'master'.
drummerwolli, creichelt-transporeon and mrkhedri
Metadata
Metadata
Assignees
Labels
No labels