We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Given this json:
{ "changes": [ { "toHash": "0000000000000000000000000000000000000000" }, { "toHash": "bb7550763f970f71a9053bf238ec46815c33c4e3" }, { "toHash": "198fb09bb2aab83bf238ec53e01a48ac83c553d1", "WANTED": "WANTED" }, { "toHash": "0000000000000000000000000000000000000000" } ] }
I would expect this JSONPath expression:
$.changes.[?(@.toHash!="0000000000000000000000000000000000000000")][-1:]
To give the last element, where the toHash is not all zeros, i.e. element:
toHash
{ "toHash": "198fb09bb2aab83bf238ec53e01a48ac83c553d", "WANTED": "WANTED" }
However, I get an empy list []. Ist this a bug, or am I misunderstanding something?
[]
The text was updated successfully, but these errors were encountered:
可能是语法不支持吧,分开步骤就可以得到结果 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);
Sorry, something went wrong.
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
No branches or pull requests
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?The text was updated successfully, but these errors were encountered: