[英]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 .我想对 Jayway
JsonPath
使用“规范化路径表达式”选项,如本示例所示。 The documentation for JsonPath
shows this simple example: JsonPath
的文档显示了这个简单的示例:
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?
请问这是怎么做的?
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("$..*");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.