Open q2w opened 10 months ago
@kallestenflo
Please provide a test in your PR that demonstrates a case.
@kallestenflo Thanks! I have added a test case for the same.
Json:
"{\"empty\": [], \"number-series\" : [[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12]]}"
JsonPath: "$.number-series.first().last()"
Before this change, the test case is failing with below error.
Expected to find an object with property [')'] in path $['number-series'] but found 'net.minidev.json.JSONArray'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JsonSmartJsonProvider'.
com.jayway.jsonpath.PathNotFoundException: Expected to find an object with property [')'] in path $['number-series'] but found 'net.minidev.json.JSONArray'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JsonSmartJsonProvider'.
@kallestenflo
Currently a function with no arguments is not parsed correctly. Given
$.objects.keys().size()
, after encountering keys (a function with no arguments) the position should move from $.objects.keys(
).size() to $.objects.keys().
size(). But in current implementation read position moves from $.objects.keys(
).size() to $.objects.keys()
.size()This pull request will fix the issue.