Package javax.json
Interface JsonPatch
public interface JsonPatch
JsonPatch is a format for expressing a sequence of operations to apply on a target JSON document.
A JsonPatch is an array of 'operations' in the form e.g.
[ { "op": "add", "path": "/foo/-", "value": ["abc", "def"] } { "path": "/a/b/c", "op": "add", "value": "foo" } ]
The 'operations' are performed in the order they are in the JsonPatch and applied to the 'result' JSON document from the previous operation.
- Since:
- 1.1
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
An enumeration of available operations forJsonPatch
. -
Method Summary
Modifier and TypeMethodDescription<T extends JsonStructure>
Tapply
(T target) Applies theJsonPatch
to the giventarget
.
-
Method Details
-
apply
Applies theJsonPatch
to the giventarget
. If the giventarget
isnull
aNullPointerException
will be thrown.- Parameters:
target
- - the target to apply theJsonPatch
- Returns:
- 'patched'
JsonStructure
- Throws:
NullPointerException
- iftarget
isnull
-
toJsonArray
JsonArray toJsonArray()- Returns:
- the JsonPatch as
JsonArray
-