'How is the "Normalized path expressions" option to Jayway JsonPath used?
I'd like to use the "Normalized path expressions" option to Jayway JsonPath, as illustrated by this example. The documentation for JsonPath shows this simple example:
String json = "...";
List<String> authors = JsonPath.read(json, "$.store.book[*].author");
I'd like to make the call
List<String> allPaths = JsonPath.read(json, "$..*", <option here?>);
and obtain the result as "Normalized path expressions" as illustrated by this example. How is that done, please?
Solution 1:[1]
This works
import com.jayway.jsonpath.Configuration;
import static com.jayway.jsonpath.JsonPath.using;
import static com.jayway.jsonpath.Option.AS_PATH_LIST;
Configuration conf = Configuration.builder().options(AS_PATH_LIST).build();
ArrayList<String> allPaths = using(conf).parse(jsonString).read("$..*");
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Arthur |
