JSON.Patch

implements RFC 6902 JSON Patch, a JSON array of operation objects describing a sequence of changes to a document.

apply

defn

(Fn [(Ref JSON a), (Ref JSON b)] (Result JSON JSON.PatchError))

                        (apply doc patch)
                    

applies an RFC 6902 JSON Patch to doc, returning a (Result JSON PatchError). Operations are applied in order and the patch is atomic: on failure doc is untouched and the error names the operation index.

(JSON.Patch.apply &doc &patch)