diff --git a/json-path/src/main/java/com/jayway/jsonpath/internal/path/PathCompiler.java b/json-path/src/main/java/com/jayway/jsonpath/internal/path/PathCompiler.java index 27b6e063..66851a58 100644 --- a/json-path/src/main/java/com/jayway/jsonpath/internal/path/PathCompiler.java +++ b/json-path/src/main/java/com/jayway/jsonpath/internal/path/PathCompiler.java @@ -235,7 +235,7 @@ else if (path.charAt(i) == OPEN_PARENTHESIS) String functionName = path.subSequence(startPosition, endPosition).toString(); functionParameters = parseFunctionParameters(functionName); } else { - path.setPosition(readPosition + 1); + path.setPosition(readPosition + 2); } } else { diff --git a/json-path/src/test/java/com/jayway/jsonpath/PathCompilerTest.java b/json-path/src/test/java/com/jayway/jsonpath/PathCompilerTest.java index a4e1b096..05decb97 100644 --- a/json-path/src/test/java/com/jayway/jsonpath/PathCompilerTest.java +++ b/json-path/src/test/java/com/jayway/jsonpath/PathCompilerTest.java @@ -323,4 +323,11 @@ public void accept_only_a_single_comma_between_indexes() { public void property_must_be_separated_by_commas() { assertThrows(InvalidPathException.class, () -> compile("$['aaa'}'bbb']")); } + + @Test + public void function_with_no_argument_can_be_parsed() { + String json = "{\"empty\": [], \"number-series\" : [[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12]]}"; + Integer result = JsonPath.read(json, "$.number-series.first().last()"); + assertThat(result).isEqualTo(10); + } }