Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}