|
|
@ -235,12 +235,20 @@ String json = "{\"date_as_long\" : 1411455611975}"; |
|
|
|
Date date = JsonPath.parse(json).read("$['date_as_long']", Date.class); |
|
|
|
Date date = JsonPath.parse(json).read("$['date_as_long']", Date.class); |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
If you configure JsonPath to use the `JacksonMappingProvider` you can even map your JsonPath output directly into POJO's. |
|
|
|
If you configure JsonPath to use `JacksonMappingProvider` or GsonMappingProvider` you can even map your JsonPath output directly into POJO's. |
|
|
|
|
|
|
|
|
|
|
|
```java |
|
|
|
```java |
|
|
|
Book book = JsonPath.parse(json).read("$.store.book[0]", Book.class); |
|
|
|
Book book = JsonPath.parse(json).read("$.store.book[0]", Book.class); |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
To obtainin full generics type information, use TypeRef. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```java |
|
|
|
|
|
|
|
TypeRef<List<String>> typeRef = new TypeRef<List<String>>() {}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> titles = JsonPath.parse(JSON_DOCUMENT).read("$.store.book[*].title", typeRef); |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Predicates |
|
|
|
Predicates |
|
|
|
---------- |
|
|
|
---------- |
|
|
|
There are three different ways to create filter predicates in JsonPath. |
|
|
|
There are three different ways to create filter predicates in JsonPath. |
|
|
|