Paste JSON in both panels to compare
Paste JSON in both panels to compare
Paste JSON in both panels to compare
Paste JSON in both panels to compare
Paste one JSON document as JSON A and another as JSON B. The tool parses both and compares them value by value, so whitespace, formatting and key order never count as differences. It reports how many keys were added, removed or changed, then shows both documents side by side with the differing lines highlighted. Arrays are compared by position.
By Ankit Aglawe · Updated · Runs entirely in your browser
The output is the list of differences the tool counts (it reports "6 differences found"). replicas going from the number 2 to the string "2" counts as a change, which is often exactly the bug you are hunting. A removed object is reported once at its own path, not once per field inside it.
// JSON A (before)
{
"name": "billing-api",
"version": "1.4.2",
"replicas": 2,
"env": { "LOG_LEVEL": "info", "REGION": "eu-west-1" },
"features": ["invoices", "refunds"],
"healthcheck": { "path": "/health", "interval": 30 }
}
// JSON B (after)
{
"name": "billing-api",
"version": "1.5.0",
"replicas": "2",
"env": { "LOG_LEVEL": "debug", "REGION": "eu-west-1", "SENTRY_DSN": null },
"features": ["invoices", "refunds", "disputes"]
}[
{ "path": "env.LOG_LEVEL", "type": "changed", "oldValue": "info", "newValue": "debug" },
{ "path": "env.SENTRY_DSN", "type": "added", "newValue": null },
{ "path": "features[2]", "type": "added", "newValue": "disputes" },
{ "path": "healthcheck", "type": "removed", "oldValue": { "path": "/health", "interval": 30 } },
{ "path": "replicas", "type": "changed", "oldValue": 2, "newValue": "2" },
{ "path": "version", "type": "changed", "oldValue": "1.4.2", "newValue": "1.5.0" }
]Arrays are matched index by index, so inserting one element shifts everything after it: 5 differences for one real change. If order does not matter in your data, sort both arrays (for example with jq '.items |= sort_by(.sku)') before comparing.
// JSON A (before)
{"items":[{"sku":"A1","qty":1},{"sku":"B2","qty":2}]}
// JSON B (after)
{"items":[{"sku":"Z9","qty":5},{"sku":"A1","qty":1},{"sku":"B2","qty":2}]}[
{ "path": "items[0].qty", "type": "changed", "oldValue": 1, "newValue": 5 },
{ "path": "items[0].sku", "type": "changed", "oldValue": "A1", "newValue": "Z9" },
{ "path": "items[1].qty", "type": "changed", "oldValue": 2, "newValue": 1 },
{ "path": "items[1].sku", "type": "changed", "oldValue": "B2", "newValue": "A1" },
{ "path": "items[2]", "type": "added", "newValue": { "sku": "B2", "qty": 2 } }
]{"b":1,"a":2} and {"a":2,"b":1} compare as identical. Objects are compared by key name, so reordering keys never shows up as a difference.
Arrays are compared position by position, with no attempt to match moved elements. A sort, an insert at the front, or a reordered list reports most elements as changed.
A key that is null in A and absent in B is reported as removed. A key that is null in one and {} in the other is changed. They are different states and the diff keeps them apart.
2 vs "2", [] vs {}, and true vs "true" are all reported as changed. Numbers that parse to the same value are equal, so 1 and 1.0 are identical.
Both documents go through JSON.parse, so integers beyond 2^53 are rounded first. 9007199254740993 and 9007199254740992 compare as equal. Diff 64-bit ids as strings, or with a text diff.
The side-by-side view pretty prints both documents with 4 spaces and highlights lines by line number. After an added or removed key, the lines below it are highlighted too even if their content matches. The difference count is computed structurally and is the number to trust.
Paths are joined with dots, so a key literally named "a.b" and a nested a then b both appear as a.b. Rare in practice, but worth knowing when reading paths.
Enter the original JSON in the left pane and the modified JSON in the right pane. Both must be valid JSON objects or arrays.
The tool highlights added, removed, and changed values with color coding. Each difference shows the full path and before/after values.
Copy the structured diff output for documentation, code reviews, or bug reports. Each change is listed with its JSONPath location.
Paste the first file into JSON A and the second into JSON B. The tool shows the number of differences and highlights both documents side by side. Both must be valid JSON.
Yes for object keys: they are matched by name. No for arrays: elements are compared by index, so the same items in a different order count as changes.
No. Both inputs are parsed before comparing, so a minified and a pretty-printed copy of the same data are identical.
No. 2 and "2" are reported as changed, because the types differ. That is usually the point of comparing API responses.
A text diff like git diff reports moved keys and re-indented lines. A structural diff only reports data that changed. Use a text diff when you care about formatting; use this when you care about values.
No. Both are parsed and compared in your browser.
Need several formats at once? Convert All shows every output from one paste. Or browse all JSON converters.