Free JSON Patch tool and API
How it works
jsonpatch.me is a free online service for running JSON Patch commands. JSON Patch is a transformation language for JSON files written in JSON.
If you remember XSLT for transforming an XML file to another XML file using XML transformation commands, JSON Patch is sort of the same but for JSON files.
jsonpatch.me has two features so far:
{
"message": "Hello World",
"from": "Unknown"
}
[
{ "op": "replace", "path": "/message", "value": "Patching JSON is fun" },
{ "op": "add", "path": "/with", "value": "jsonpatch.me" },
{ "op": "remove", "path": "/from" }
]
{
"message": "Patching JSON is fun",
"with": "jsonpatch.me"
}
If you need a single patch using a source JSON file and a JSON Patch file, you can use the on-demand tool available.
Input JSON and one or more patch commands below and see magic happen:
If you need to run JSON Patch commands on a continuous basis (like from a build-server), you can use the JSON Patch API documented below. The JSON Patch API will let you upload JSON Patch commands and run these commands by making POST requests with the JSON to patch in the body.
Start by uploading a JSON Patch document. Send the patch commands in the body of a POST request:
POST https://api.jsonpatch.me/upload/
[
{ "op": "replace", "path": "/message", "value": "Patching JSON is fun" },
{ "op": "add", "path": "/with", "value": "jsonpatch.me" },
{ "op": "remove", "path": "/from" }
]
This will return a JSON response:
{ "isSuccess": true, "templateId": "94188217-e01f-4951-af9b-e32418b23e7c" }
To patch a JSON document using the uploaded template use the following endpoint:
PATCH https://api.jsonpatch.me/patch/?templateId=94188217-e01f-4951-af9b-e32418b23e7c
{
"message": "Hello World",
"from": "Unknown"
}
The request will return the patched JSON:
{
"message": "Patching JSON is fun",
"with": "jsonpatch.me"
}
The patch endpoint accepts both PATCH and POST requests. To replace an uploaded patch, post the new commands to the upload endpoint with the template id:
POST https://api.jsonpatch.me/upload/?templateId=94188217-e01f-4951-af9b-e32418b23e7c
If you don't want to upload a patch first, send both the JSON and the patch in a single request:
POST https://api.jsonpatch.me/fullpatch/
{
"json": {
"message": "Hello World",
"from": "Unknown"
},
"patch": [
{ "op": "replace", "path": "/message", "value": "Patching JSON is fun" },
{ "op": "add", "path": "/with", "value": "jsonpatch.me" },
{ "op": "remove", "path": "/from" }
]
}
The response contains the patched JSON as a string in the result property:
{
"isSuccess": true,
"result": "{\"message\":\"Patching JSON is fun\",\"with\":\"jsonpatch.me\"}",
"errorMessage": null
}