JSON Diff
Compare two JSON objects and get an RFC 6902 JSON Patch of the differences.
/v1/json-diff
curl -X POST "https://devtools.toolkitapi.io/v1/json-diff" \
-H "Content-Type: application/json" \
-d '{"a": {"name": "Alice", "age": 30}, "b": {"name": "Alice", "age": 31, "city": "NYC"}}'
import httpx
resp = httpx.post(
"https://devtools.toolkitapi.io/v1/json-diff",
json={"a": {"name": "Alice", "age": 30}, "b": {"name": "Alice", "age": 31, "city": "NYC"}},
)
print(resp.json())
const resp = await fetch("https://devtools.toolkitapi.io/v1/json-diff", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({"a": {"name": "Alice", "age": 30}, "b": {"name": "Alice", "age": 31, "city": "NYC"}}),
});
const data = await resp.json();
console.log(data);
# See curl example
{
"patch": [
{"op": "replace", "path": "/age", "value": 31},
{"op": "add", "path": "/city", "value": "NYC"}
],
"summary": {
"added": 1,
"removed": 0,
"changed": 1,
"total": 2
}
}
Try It Live
Description
How to Use
1. Send a POST request with `a` (the original object) and `b` (the modified object).
2. The response contains a `patch` array with RFC 6902 operations (`add`, `remove`, `replace`) and a `summary` with counts.
3. Apply the patch to `a` to reproduce `b`, or use the summary to gauge the scope of changes.
About This Tool
JSON Diff compares two JSON objects and produces an RFC 6902-style JSON Patch describing every difference. It recursively walks both objects, detecting added keys, removed keys, and changed values — including nested objects and arrays.
The summary gives you a quick overview of how many fields were added, removed, or changed.
Why Use This Tool
- API versioning — Compare API response shapes across versions
- Config drift detection — Spot unexpected changes between config snapshots
- Code review — Visualize JSON schema changes in pull requests
- Data migration — Verify transformations produce the expected output
Frequently Asked Questions
Does it handle nested objects?
Is the patch output compatible with RFC 6902?
Can I compare arrays?
Start using JSON Diff now
Get your free API key and make your first request in under a minute.