Skip to content

Patch.Mode enumeration

A JSON Patch document is just a JSON file containing an array of patch operations. The patch operations supported by JSON Patch are “add”, “remove”, “replace”, “move”, “copy” and “test”. The operations are applied in order: if any of them fail then the whole patch operation should abort.

public enum Mode : byte

Values

name value description
add 0 Adds a value to an object or inserts it into an array. In the case of an array, the value is inserted before the given index. The - character can be used instead of an index to insert at the end of an array.
remove 1 Removes a value from an object or array. --OR-- Removes the first element of the array at biscuits (or just removes the “0” key if biscuits is an object)
replace 2 Replaces a value. Equivalent to a “remove” followed by an “add”.
copy 3 Moves a value from one location to the other. Both from and path are JSON Pointers.
move 4 Copies a value from one location to another within the JSON document. Both from and path are JSON Pointers.
test 5 Tests that the specified value is set in the document. If the test fails, then the patch as a whole should not apply.

See Also