We've written extensively about both JSON Patch and JSON Merge Patch over the last few days, but while writing our comparison between them I realized a glaring discrepancy in the amount of content and tooling. JSON Patch is a more complicated specification, so it makes sense why there is a need for more blogs, libraries, and other resources to help explain and implement it. Meanwhile, you can likely use AI to generate the code for implementing JSON Merge Patch in whichever language you want.
The lack of tooling around JSON Merge Patch does make it harder for developers to quickly dive in and start building with the format. We prefer to dive in and get our hands dirty rather than reading an RFC.
That's why we at Zuplo created jsonmergepatch.com - a FREE tool for learning and using JSON Merge Patch. jsonmergepatch.com allows you to
- Generate a JSON Merge Patch between two JSON objects
- Apply a JSON Merge Patch to a JSON object
- Upload a JSON document via API and perform HTTP PATCH calls against that document
Of course, we open sourced all of this goodness. Here's the Github links for the web tool and for the REST API.
Generating a Patch
If you don't already have a JSON Merge Patch handy, you can create one. Simply provide two JSON objects and the result will be a JSON Merge Patch that would transform JSON A to JSON B.
Applying a Patch
Once you have a patch, you can apply it to a JSON object of your choice, and observe the patches result. This is a great way to get familiar with the different JSON Merge Patch features, including adding, removing, and modifying properties.
Using the REST API
Obviously we aren't going to create a web tool without creating a REST API for it. Just as obvious, we used Zuplo to build it, so can read the autogenerated API docs and start making calls now. Currently, the API supports uploading a JSON object, and then applying JSON Merge Patches to it via HTTP Patch. The response is the resulting patched JSON object.
Improving Your APIs with JSON Merge Patch
JSON Merge Patch is a powerful and efficient way to perform partial updates on JSON documents. We hope this tool helps developers understand how it works, allowing them to build more efficient APIs that send less data over the network and process updates more quickly. If you're looking to implement JSON Merge Patch across your APIs or just want to modernize your APIs more generally, and want advice from an API expert - get in touch.
Top comments (0)