←back to thread

JSON Patch

(zuplo.com)
299 points DataOverload | 2 comments | | HN request time: 2.135s | source
1. quietbritishjim ◴[] No.41882563[source]
> Strengths: ... Idempotency: JSON Patch operations can be safely retried without causing unintended side effects.

So, wait, you can't add an item to an array with this (except at a predefined position)? I.e. "add" with path "/.../myarray/~" (if I've understand their notation right) isn't allowed?

I'm not sure if that's good or bad, but it's certainly surprising and could do with saying a bit more explicitly.

replies(1): >>41886622 #
2. uzerfcwn ◴[] No.41886622[source]
You can add to the end of an array by using the path /.../myarray/-, i.e., the index is replaced by a dash.

JSON patch is indeed not idempotent.