JSON diff
Compare two JSON documents and get the differences as a JSON Patch (RFC 6902).
Input
Result
Fill in the input and press Run.
Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.
Use it from code or an agent
curl -s https://setget.net/v1/tools/json-diff \
-H 'Content-Type: application/json' \
-d '{"input":{"before":"{\"a\":1,\"b\":[1,2],\"c\":true}","after":"{\"a\":2,\"b\":[1,2,3]}"}}'
import json, urllib.request
body = {'input': {'before': '{"a":1,"b":[1,2],"c":true}', 'after': '{"a":2,"b":[1,2,3]}'}}
request = urllib.request.Request("https://setget.net/v1/tools/json-diff", json.dumps(body).encode(),
{"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/json-diff", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"input":{"before":"{\"a\":1,\"b\":[1,2],\"c\":true}","after":"{\"a\":2,\"b\":[1,2,3]}"}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
"slug": "json-diff",
"input": {
"before": "{\"a\":1,\"b\":[1,2],\"c\":true}",
"after": "{\"a\":2,\"b\":[1,2,3]}"
}
}
{
"input": {
"before": "{\"a\":1,\"b\":[1,2],\"c\":true}",
"after": "{\"a\":2,\"b\":[1,2,3]}"
}
}
Endpoint: POST /v1/tools/json-diff. Over MCP: run_tool with slug: "json-diff".
Machine-readable: input schema, Markdown. Connect an agent.
Inputs
| Name | Type | Required | What it does |
|---|---|---|---|
before |
string | yes | The original JSON. |
after |
string | yes | The changed JSON. |
Example
Input
{
"before": "{\"a\":1,\"b\":[1,2],\"c\":true}",
"after": "{\"a\":2,\"b\":[1,2,3]}"
}Result
{
"equal": false,
"patch": [
{
"op": "remove",
"path": "/c"
},
{
"op": "replace",
"path": "/a",
"value": 2
},
{
"op": "add",
"path": "/b/-",
"value": 3
}
],
"summary": {
"add": 1,
"remove": 1,
"replace": 1
}
}Questions
- Does key order matter?
- No. Objects are compared by key, so reordering keys is not a difference.
- How are arrays compared?
- Position by position. An item inserted at the start shows as changes to every later position.
Related tools
- JSON Patch applyApply a JSON Patch (RFC 6902) to a document: add, remove, replace, move, copy and test.
json-patch-apply - Text diffCompare two texts line by line and get a unified diff with counts of added and removed lines.
diff - JSON Merge PatchMerge a JSON Merge Patch (RFC 7386) into a document: objects merge, null deletes a key.
json-merge-patch - .env to JSONParse a .env file into a JSON object, handling quotes, comments and "export" prefixes.
env-to-json - CSV profilerSummarise each CSV column: type, blanks, distinct values, min, max, mean and top values.
csv-profile - CSV sort, filter and dedupeSort CSV by a column, keep rows containing some text, pick columns and remove duplicate rows.
csv-sort-filter-dedupe