Open con-f-use opened 3 months ago
可能是语法不支持吧,分开步骤就可以得到结果 Configuration configuration = Configuration.builder() .jsonProvider(new JsonSmartJsonProvider()) .build(); // 解析一次文档 ReadContext ctx = JsonPath.using(configuration).parse(json); List<Map<String, Object>> filteredChanges = ctx.read("$.changes[?(@.toHash != '0000000000000000000000000000000000000000')]"); Map<String, Object> lastFilteredChange = filteredChanges.isEmpty() ? null : filteredChanges.get(filteredChanges.size() - 1); System.out.println(lastFilteredChange);
Thank you, but unfortunately I cannot separate the steps, since I'm using it in a Jenkins plugin. I have no influence over the Java code.
all right
Given this json:
I would expect this JSONPath expression:
To give the last element, where the
toHash
is not all zeros, i.e. element:However, I get an empy list
[]
. Ist this a bug, or am I misunderstanding something?