The JSON Merge Patch API allows you to upload JSON documents and apply JSON Merge Patch operations to them.
You can learn more about JSON Merge Patch in this article.
Created with ❤️ by Zuplo
The first step is to upload a JSON object to perform merge-patches on.
curl --request POST \
--url https://api.jsonmergepatch.com/upload \
--header 'Content-Type: application/json' \
--data '
{
"title": "Hello world",
"summary": "A simple summary",
"data": {
"age": 3
}
}
'
The API will return a 200 response with the targetId
:
{
"targetId": "abc1234"
}
This targetId
is a unique identifier for your JSON object.
Make a call to the /apply/{targetId}
endpoint with a Merge Patch in the body to apply it.
curl --request PATCH \
--url https://api.jsonmergepatch.com/apply/abc1234
--header 'Content-Type: application/merge-patch+json'
--data '
{
"title": "Changed title",
"type": "book"
"summary": null,
"data": {
"someNewProperty": "wow"
"age": 4
}
}
'
The API will return the result of the Merge Patch:
{
"title": "Changed title",
"type": "book",
"data": {
"someNewProperty": "wow",
"age": 4
}
}