JSON Merge Patch (RFC 7396): Simple Partial Updates Explained
JSON Merge Patch (RFC 7396) provides a simple way to describe partial updates to JSON documents. Unlike the more complex JSON Patch (RFC 6902), merge patch uses a partial document that's applied directly. Our JSON Merge Patch tool makes it easy to apply and test merge patches.
What Is JSON Merge Patch?
A JSON Merge Patch is a JSON document that describes changes to be made to a target document. When a field is included in the patch, its value replaces the existing value. When a field is set to null, it's removed from the target.
JSON Merge Patch vs JSON Patch
| Aspect | JSON Merge Patch (RFC 7396) | JSON Patch (RFC 6902) |
|---|---|---|
| Format | Partial JSON document | Array of operation objects |
| Complexity | Simple, intuitive | More operations (add, remove, replace, etc.) |
| Null Handling | Null = remove field | Explicit remove operation |
| Arrays | Replaces entire array | Index-based operations |
| Use Case | Simple object updates | Precise, complex transformations |
How to Apply a Merge Patch
- Prepare your target JSON document and your merge patch document.
- Use our JSON Merge Patch tool to apply the patch.
- Review the merged result with all changes applied.
Comparing Documents
Before and after patching, use our JSON Diff Checker to see exactly what changed. For merging multiple JSON objects without patch semantics, use JSON Merge.
Frequently Asked Questions
When should I use Merge Patch vs JSON Patch?
Use Merge Patch for simple object updates where you want to replace or remove top-level fields. Use JSON Patch for complex operations involving array indices or multiple operation types.
How does null work in Merge Patch?
Setting a field to null in the patch removes that field from the target document. This is the standard way to delete fields in Merge Patch.
Use our free JSON Merge Patch tool for your partial update needs.