-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
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
JSON pointer query, trailing slashes and empty keys #410
Comments
Investigating... |
Please reference the RFC you read? |
I am referring to RFC 6901, and a discussion I found about implementation details.
Additionally, the list of examples contains the mapping of pointer (left) to evaluation result (right)
for an example document
Unfortunately, the RFC does not specify this in greater depth, but given the wording cited above ("prefixed by'/'), I would assert that trailing slashes should be valid and that they should reference empty keys (or fail, if none exists at that level). I won't be able to check the proposed fix today, will try and look at it tomorrow. Thanks, |
Hey,
I found an inconsistency, or potentially a bug, with the handling of JSON pointers in JSONObject.query().
Specifically, the handling of trailing slashes differs between the root element and elements further down.
From reading the RFC and a discussion about it, I got the impression that a trailing slash is supposed to refer to an empty key, but this only works with the root element.
For elements further down, a trailing slash will not select the empty key below the element, but the element itself instead.
example code
output for example code above
expected output (last line)
This happens with both the string and URI fragment representations, using the 20180130 maven artifact.
Thanks,
M.
The text was updated successfully, but these errors were encountered: