You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a problem with the JsonPatch implementation of this library.
Actually, if one of the JsonStructure has a property key name that contains a '/', it isn't encode in the operation 'path'. So the property key name is interpreted by JsonPointer as two keys.
Additionally, operation objects MUST have exactly one "path" member.
That member's value is a string containing a JSON-Pointer value
[RFC6901] that references a location within the target document (the
"target location") where the operation is performed.
A JSON Pointer is a Unicode string (see [RFC4627], Section 3)
containing a sequence of zero or more reference tokens, each prefixed
by a '/' (%x2F) character.
Because the characters '~' (%x7E) and '/' (%x2F) have special
meanings in JSON Pointer, '~' needs to be encoded as '~0' and '/'
needs to be encoded as '~1' when these characters appear in a
reference token.
Therefore, I understand that the '/' character in a json property key name should be encode in ~1 in the operation path. Therefore, json property key name 'a/b' should have the path 'a~1b'.
The class code below put in light the problem and throw a javax.json.JsonException specified that the JSON Object don't con't contains 'a'. Which is actually true, we have 'a/b' and this is what we are looking for.
To fix this problem, I suggest to replace path + '/' + key usage in the method diffObject in the JsonPatchImpl.java, line 224, by a path + '/' + Json.encodePointer(key).
The text was updated successfully, but these errors were encountered:
dylanbehetre
changed the title
The '/' character in JSON property key isn't encoding in path as advise by RFC6901 - Json Pointer
The '/' character in JSON property key isn't encoding in path as required by RFC6901 - Json Pointer
Apr 24, 2019
dylanbehetre
changed the title
The '/' character in JSON property key isn't encoding in path as required by RFC6901 - Json Pointer
The '/' character in JSON property key name isn't encoding in operation path of a JsonPatch as required by RFC6901 - Json Pointer
Apr 24, 2019
Hello,
I had a problem with the JsonPatch implementation of this library.
Actually, if one of the JsonStructure has a property key name that contains a '/', it isn't encode in the operation 'path'. So the property key name is interpreted by JsonPointer as two keys.
But in the RFC6902 - JsonPatch, it's specified :
And in the RFC6901 - JsonPointer, it's specified :
Therefore, I understand that the '/' character in a json property key name should be encode in ~1 in the operation path. Therefore, json property key name 'a/b' should have the path 'a~1b'.
The class code below put in light the problem and throw a
javax.json.JsonException
specified that the JSON Object don't con't contains 'a'. Which is actually true, we have 'a/b' and this is what we are looking for.To fix this problem, I suggest to replace
path + '/' + key
usage in the methoddiffObject
in theJsonPatchImpl.java
, line 224, by apath + '/' + Json.encodePointer(key)
.The text was updated successfully, but these errors were encountered: