Closed slz30 closed 2 weeks ago
Ok, this took a while to parse. My first though is that:
~0
and ~1
be mean escaped ~
and /
characters, respectively. Spec is unclear on this point tho~/
combination is taken to mean roughly same as ~1
, that is, escaped /
character -- so it'd look for key "nums/0"
hence not matching array at "nums~
Changing behavior is slightly backwards incompatible so fix would need to go in 2.19.
Ok, so, behavior for tilde NOT followed by either '0' or '1' is technically unspecified, as far as I understand. The current implementation basically considers tilde to be "general escape", so if any other character than '0' or '1' follows, that character is used as-is, and tilde is skipped/ignored.
That is why the case here fails: key to look for is "nums/0"
.
I think I will change the behavior to instead include "lone" tildes as regular characters, so test as given would pass. This does seem like slightly more correct behavior.
JsonPointer is compatible with non escaped characters~, but this compatibility fails when~is located at the end of FieldName and followed by /. Here is a simple example