From 51076180f71d075b74d22043de930da555ad9b4e Mon Sep 17 00:00:00 2001 From: Marcin Mielnicki Date: Mon, 15 Jun 2015 22:49:57 +0200 Subject: [PATCH] Tweaking configuration examples with current API --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2be595cd..55b311cd 100644 --- a/README.md +++ b/README.md @@ -308,16 +308,16 @@ This option makes JsonPath return null for missing leafs. Consider the following Configuration conf = Configuration.defaultConfiguration(); //Works fine -String gender0 = JsonPath.using(conf).read(json, "$[0]['gender']"); +String gender0 = JsonPath.using(conf).parse(json).read("$[0]['gender']"); //PathNotFoundException thrown -String gender1 = JsonPath.using(conf).read(json, "$[1]['gender']"); +String gender1 = JsonPath.using(conf).parse(json).read("$[1]['gender']"); Configuration conf2 = conf.addOptions(Option.DEFAULT_PATH_LEAF_TO_NULL); //Works fine -String gender0 = JsonPath.using(conf2).read(json, "$[0]['gender']"); +String gender0 = JsonPath.using(conf2).parse(json).read("$[0]['gender']"); //Works fine (null is returned) -String gender1 = JsonPath.using(conf2).read(json, "$[1]['gender']"); +String gender1 = JsonPath.using(conf2).parse(json).read("$[1]['gender']"); ``` **ALWAYS_RETURN_LIST** @@ -328,9 +328,9 @@ This option configures JsonPath to return a list even when the path is `definite Configuration conf = Configuration.defaultConfiguration(); //Works fine -List genders0 = JsonPath.using(conf).read(json, "$[0]['gender']"); +List genders0 = JsonPath.using(conf).parse(json).read("$[0]['gender']"); //PathNotFoundException thrown -List genders1 = JsonPath.using(conf).read(json, "$[1]['gender']"); +List genders1 = JsonPath.using(conf).parse(json).read("$[1]['gender']"); ``` **SUPPRESS_EXCEPTIONS**