Understanding the JSON Patch

JSON Patch is a format (identified by the media type, application/ json-patch+json) for expressing changes to a target JSON document intended for use with the HTTP PATCH method to apply partial modification of the target resource. JSON Patch operations are expressed in the JSON document, as follows:

Operation

JSON Patch document

Add: Used to add the <value> to the specified <location>.

{ op: add, path: <location>, value: <value> }

Remove: Used to remove the value at the specified <location>.

{ op: remove, path: <location>}

Replace:  Used to update the given <value> at the specified <location>.

{ op: replace, path: <location>, value: <value> }

Copy: Used to copy a value from the <from-location> to the <destination-location>.

 { op: copy, from: <from-location>, path: <destination-location> }

MoveUsed to move a value from the <from-location> to the <destination-location>.

 { op: move, from: <from-location>, path: <destination-location> }

Test: Used to test the presence of a given value at the specified location.

The Result of the test operation can be used to decide before performing other patch operations.

{ op: test, path: <location>, value: <value> }

]

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.186.83