JSON Merge & Patch
- RFC 6902
- RFC 7386
- Nothing uploaded
Deep-merge two documents, or generate the RFC 7386 or RFC 6902 patch between them.
Paste input on the left to see result.
Everything runs in your browser — nothing is uploaded.
About merge & patch
JSONic performs three operations on a pair of JSON documents: a deep merge that combines them, an RFC 7386 merge patch that uses null to signal a deletion, and an RFC 6902 JSON Patch listing explicit add, remove and replace operations with correctly escaped JSON Pointers.
Three related operations on a pair of documents. Deep merge combines them, with the right-hand document winning on conflicts and arrays replaced rather than concatenated. Merge patch (RFC 7386) produces the compact diff you would PATCH to an API, using null to mean deletion. JSON Patch (RFC 6902) produces the explicit add/remove/replace operation list, with correctly escaped JSON Pointers.
Questions
When should I use JSON Patch rather than merge patch?
Merge patch is smaller and easier to read, but it cannot express setting a value to null, and it replaces arrays wholesale. JSON Patch can express both, and is what you want when the target API declares application/json-patch+json.
Why are arrays replaced rather than merged?
Because merging them requires guessing whether elements are identities or positions. Replacing is predictable, and is what RFC 7386 specifies. For element-level changes, use the JSON Patch output, which addresses array indices individually.
Are JSON Pointer special characters handled?
Yes — keys containing / or ~ are escaped as ~1 and ~0 in the generated pointers, as the specification requires.