News for hackers. Stuff that matters.
Re:What Is JSON Patch? by rendall on Tuesday May 10, 2022 @02:51AM (#31324261)
There are all kinds of solutions ("why not just use undefined instead?"), but whichever it is, a decision has to be made, documented, remembered, and edge cases decided. Whatever you have, now the API has a non-obvious custom spec just for that API alone. It's not a "why not just".

I guarantee, another dev would come along, look at the custom spec, and think "Why not just use JSON Patch?"

Re:What Is JSON Patch? by ratww on Tuesday May 10, 2022 @04:35AM (#31324836)
undefined would in theory be slightly "better" for deleting values (the value { key: undefined } serializes to {}), but, alas, it isn't supported by JSON, so you'd have to use a custom serializer and deserializer for it to even work.
Re:What Is JSON Patch? by crabmusket on Tuesday May 10, 2022 @08:43AM (#31326386)
I would expect in such cases that JSON Merge Patch, and its media type, would be used to head off bikeshedding discussions.

https://www.rfc-editor.org/rfc/rfc7396.html