CoreJSON

JSON Merge Patch

This tool applies a JSON Merge Patch per RFC 7396. Paste a target JSON document and a merge patch and it merges them by the spec: keys in the patch overwrite the target, a null value deletes that key, and a non-object patch replaces the target entirely. It is useful for simulating the effect of an HTTP PATCH request, and merging runs locally in your browser so nothing is uploaded.

Open in the workbench Runs locally · nothing is uploaded

How to use it

  1. 1

    Paste the target JSON

    Put the original data to be modified on the left, or open a local file.

  2. 2

    Paste the merge patch

    Put the patch object on the right — an "object that looks like the result", containing only the keys you want to change.

  3. 3

    Pause to apply

    The tool recursively merges per RFC 7396 and outputs the result on the right; if either side is invalid JSON it reports the line and column.

  4. 4

    Copy or generate in reverse

    Copy the merged result, or switch to generate mode to derive a patch from two JSON documents.

Key features

Strict RFC 7396

null deletes a key, objects merge recursively and non-object values replace wholesale, matching the specification exactly.

Two-column comparison

Target, patch and result on one screen, so each change shows its effect immediately.

Side-specific errors

When the target or the patch is invalid JSON it states which side failed and gives the line and column.

Array replacement

Arrays are replaced as a whole rather than merged element by element, which is what the spec prescribes.

Worker-based local compute

Merging runs on a background thread in your browser and the data is not uploaded.

Companion generate mode

Switch to generate mode to produce a merge patch from before-and-after documents without leaving the page.

Common errors & troubleshooting

  • ! A merge patch cannot set a value to null — null always means "delete this key". If you genuinely need a null value, use JSON Patch or a full replacement instead.
  • ! Arrays are replaced entirely, never merged item by item; writing an array in the patch means "replace with exactly this array".
  • ! Test the patch against a copy of the real target first, since a non-object patch replaces the whole document.
  • ! Keep an eye on which side is the target: swapping the documents changes the merge direction.

Frequently asked questions

How is merge patch different from JSON Patch?

JSON Patch (RFC 6902) describes changes as a list of add / remove / replace operations — precise but verbose. Merge Patch (RFC 7396) describes changes with a single object that "looks like the result" — simple and intuitive, but it cannot set null directly and arrays can only be replaced whole.

What happens to a null in the patch?

It means delete the corresponding key in the target; if the target does not have the key there is no effect.

Is my data uploaded?

No. Merging happens locally in your browser.

Which content type does a merge patch use over HTTP?

application/merge-patch+json, which is the media type registered alongside RFC 7396 for PATCH requests.

Related tools