Package javax.json

Interface JsonPatchBuilder

  • public interface JsonPatchBuilder
    TODO this is a final class in the spec, but that makes no sense. This class can be used to easily create JsonPatches. To get an instance use Json.createPatchBuilder() or Json.createPatchBuilder(JsonArray) The order of the operations corresponds to the order they are builded.

    NOTICE: A JsonPatchBuilder contains state and therefore is NOT threadsafe and should not be used concurrently.

    The following JsonPatch

               "op": "add",
               "path": "/add/object",
               "value": {
                 "foo": "bar"
               "op": "remove",
               "path": "/remove/it"
               "op": "move",
               "path": "move/to",
               "from": "move/from"
    can be build with the JsonPatchBuilder
         JsonPatch patch = Json.createJsonPatchBuilder()
                               .add("/add/object", Json.createObjectBuilder()
                                                       .add("foo", "bar")
                               .move("/move/to", "move/from")

    An instance of a JsonPatchBuilder can be reused for another JsonPatch after the build()-Method was called.