繁体   English   中英

Jayway JsonPath 的“规范化路径表达式”选项如何使用?

[英]How is the "Normalized path expressions" option to Jayway JsonPath used?

我想对 Jayway JsonPath使用“规范化路径表达式”选项,如本示例所示 JsonPath的文档显示了这个简单的示例:

String json = "...";
List<String> authors = JsonPath.read(json, "$.store.book[*].author");

我想打电话

List<String> allPaths = JsonPath.read(json, "$..*", <option here?>);

并获得结果为“规范化路径表达式”,如本例所示 请问这是怎么做的?

这有效

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM