From b6e8d37a28a8b3af5c297d7797f750acb02b6201 Mon Sep 17 00:00:00 2001 From: Kalle Stenflo Date: Tue, 23 Sep 2014 11:32:28 +0200 Subject: [PATCH] Updated docs. --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 17cdb1ac..62a02acb 100644 --- a/README.md +++ b/README.md @@ -236,7 +236,7 @@ As specified in the Goessner implementation a JsonPath can return either `Path` ```java Configuration conf = Configuration.builder().options(Option.AS_PATH_LIST).build(); -List pathList = using(conf).parse(JSON_DOCUMENT).read("$..author"); +List pathList = using(conf).parse(json).read("$..author"); assertThat(pathList).containsExactly( "$['store']['book'][0]['author']", @@ -253,6 +253,7 @@ Tweaking Configuration When creating your Configuration there are a few option flags that can alter the default behaviour. **DEFAULT_PATH_LEAF_TO_NULL** +
This option makes JsonPath return null for missing leafs. Consider the following json ```javascript @@ -284,6 +285,7 @@ String gender1 = JsonPath.using(conf2).read(json, "$[1]['gender']"); ``` **ALWAYS_RETURN_LIST** +
This option configures JsonPath to return a list even when the path is `definite`. ```java @@ -295,6 +297,7 @@ List genders0 = JsonPath.using(conf).read(json, "$[0]['gender']"); List genders1 = JsonPath.using(conf).read(json, "$[1]['gender']"); ``` **SUPPRESS_EXCEPTIONS** +
This option makes sure no exceptions are propagated from path evaluation. It follows these simple rules: * If option `ALWAYS_RETURN_LIST` is present an empty list will be returned