News for hackers. Stuff that matters.
Re:Unlocking the Power of JSON Patch by ks2048 on Friday October 18, 2024 @04:41PM (#41883303)
I agree "." would make more sense than "/".

I actually think an array would be better, ["foo","bar"] for "foo.bar". How many many bugs are introduced by people not escaping properly? It's more verbose, but judging by the rest of the standard, they don't seem to be emphasizing brevity.

Re:Unlocking the Power of JSON Patch by graftak on Saturday October 19, 2024 @04:17AM (#41886443)
Not only that; both a dot (“.”) and a forward slash (“/”) are allowed to be used in/as a JSON property name.

An array of keys alleviates this issue entirely because any string element of the array can be used as a JSON object property name too.

Re:Unlocking the Power of JSON Patch by kevincox on Saturday October 19, 2024 @06:47AM (#41887060)
Definitely agree on the array. They were smart enough to use JSON for the patch format so that people didn't have to write custom parsers but then used a selector syntax that requires a custom parser (and serializer). It seems like an obvious unforced error.
Re:Unlocking the Power of JSON Patch by PufPufPuf on Saturday October 19, 2024 @10:52AM (#41888096)
You would need to somehow differentiate between absolute and relative paths, though.