Closed GoogleCodeExporter closed 8 years ago
Sorry I included the wrong pom snippet. Here's the correct one
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>0.8.1</version>
</dependency>
Original comment by brut...@gmail.com
on 1 Oct 2012 at 3:36
[deleted comment]
In version 0.9 (soon to be released) the operations below are supported
String JSON_ARRAY = "[1, 3, 5, 7, 8, 13, 20]";
JsonPath.read(JSON_ARRAY, "$[3]") => 7 //no slicing
JsonPath.read(JSON_ARRAY, "$[0,1,2]") => [1,3,5] //no slicing, multi index
JsonPath.read(JSON_ARRAY, "$[:3]") => [1,3,5] //from index 0 (inclusive)
until index 3 (exclusive)
JsonPath.read(JSON_ARRAY, "$[1:5]") => [3, 5, 7, 8] //from index 1
(inclusive) until index 5 (exclusive)
JsonPath.read(JSON_ARRAY, "$[1:15]") => IndexOutOfBoundsException
JsonPath.read(JSON_ARRAY, "$[-3:]") => [8, 13, 20] //from tail grab 3
JsonPath.read(JSON_ARRAY, "$[3:]") => 8 //grab no 3 from tail
JsonPath.read(JSON_ARRAY, "$[(@.length -3)]") => //grab no 3 from tail (same
as above)
Original comment by kalle.st...@gmail.com
on 20 Aug 2013 at 8:51
Original issue reported on code.google.com by
brut...@gmail.com
on 1 Oct 2012 at 3:35