Java 通过json路径库在不同级别使用相同的;“关键”;
让我们假设我们有一个像这样的json 使用的java json路径库 但是它会返回json块,而不仅仅是下一个值,因此我无法将其与读取过程中的当前搜索值进行比较。 你知道怎么做吗?:) 您正在寻找Java 通过json路径库在不同级别使用相同的;“关键”;,java,jsonpath,Java,Jsonpath,让我们假设我们有一个像这样的json 使用的java json路径库 但是它会返回json块,而不仅仅是下一个值,因此我无法将其与读取过程中的当前搜索值进行比较。 你知道怎么做吗?:) 您正在寻找DocumentContext类的函数 例如: jsonContext.map("$..next", (Object object, Configuration configuration) -> { return doCustomTransformation(obj
DocumentContext
类的函数
例如:
jsonContext.map("$..next", (Object object, Configuration configuration) -> {
return doCustomTransformation(object.toString());
});
您正在寻找DocumentContext
类的函数
例如:
jsonContext.map("$..next", (Object object, Configuration configuration) -> {
return doCustomTransformation(object.toString());
});
...
JSONArray jsonPathNextUrl = jsonContext.read(NEXT_URL_JSON_PATH_REGEX);
...
if (isNotEmpty(jsonPathNextUrl)) {
for (int i = 0; i < jsonPathNextUrl.size(); i ++) {
String nextJsonPath = jsonPathNextUrl.get(i).toString();
final String nextUrl = rewritePaging(nextJsonPath, replacementUrl);
// jsonContext.set("$..next" + "[" + i + "]", nextUrl);
}
}
jsonContext.read("$..[?(@.next)]")
jsonContext.map("$..next", (Object object, Configuration configuration) -> {
return doCustomTransformation(object.toString());
});