JSON Diff – Compare Two JSON Documents
Software · 2 inputs · Free
JSON Diff – Compare Two JSON Documents
Parameters
What is this tool?
JSON Diff – Compare Two JSON Documents helps developers with encoding, encryption and text processing. Compares two JSON documents structurally: key order and whitespace are ignored, and arrays are matched by index. Each difference is listed on its own line with its JSON Pointer (RFC 6901) path: added, removed, changed (old → new) or type changed; the first line sums up the counts. 1 and 1.0 are treated as the same number.
📘 Common mistakes · Worked exampleCompares two JSON documents structurally: key order and whitespace are ignored, and arrays are matched by index. Each difference is listed on its own line with its JSON Pointer (RFC 6901) path: added, removed, changed (old → new) or type changed; the first line sums up the counts. 1 and 1.0 are treated as the same number.
The result is not exact or binding and is for information only; it is not an official document and cannot be used in official procedures. Confirm it with the competent authority or a professional before acting; no liability is accepted for losses arising from its use.
Last reviewed: · Methodology and sources
How is it calculated?
Compares two JSON documents structurally: key order and whitespace are ignored, and arrays are matched by index. Each difference is listed on its own line with its JSON Pointer (RFC 6901) path: added, removed, changed (old → new) or type changed; the first line sums up the counts. 1 and 1.0 are treated as the same number.
Inputs
| Value | Unit | Example |
|---|---|---|
| Left JSON | — | {"name":"Ada","age":36,"role":"admin","tags":["a","b"],"address":{"city":"London"}} |
| Right JSON | — | {"age":37,"name":"Ada","tags":["a","b","c"],"address":{"city":"Paris","zip":"75001"},"active":true} |
What is this tool?
JSON Diff – Compare Two JSON Documents helps developers with encoding, encryption and text processing. Compares two JSON documents structurally: key order and whitespace are ignored, and arrays are matched by index. Each difference is listed on its own line with its JSON Pointer (RFC 6901) path: added, removed, changed (old → new) or type changed; the first line sums up the counts. 1 and 1.0 are treated as the same number.
Common mistakes
- Comparing an array whose order is irrelevant without sorting it. When the same elements arrive in another order, every position looks changed; sort both sides by the same criterion first.
- Expecting one line for a single element inserted at the start or in the middle of an array. Every later element shifts by one position, so all of them are reported as changed.
- Treating "1" and 1 as equal. One is a string and the other a number; the tool reports this as a type change, and it usually points to a real incompatibility.
- Treating null and a missing key as the same. {"a":null} and {} are different documents; if a key is null on one side and absent on the other, you get an added or removed line.
- Reading ~1 and ~0 in a path as part of the key. In JSON Pointer, ~1 stands for a slash and ~0 for a tilde; the path /a~1b refers to a single key named a/b.
- Expecting strings that merely look alike to be equal. Strings are compared character by character; trailing whitespace, letter case or a different Unicode spelling of the same letter all count as differences.
- Comparing documents that contain duplicate keys. If a key occurs twice in the same object, only the last occurrence is used; the earlier ones are silently ignored.
📘 JSON Diff: Comparing JSON by Structure, Key Order and Array Index →
Sources
- IETF RFC 6901: JavaScript Object Notation (JSON) Pointer ↗
- IETF RFC 6902: JavaScript Object Notation (JSON) Patch ↗
- IETF RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format ↗
- ECMA-404: The JSON data interchange syntax ↗
Key terms
Frequently Asked Questions
+JSON Diff – Compare Two JSON Documents — how is it calculated?
Compares two JSON documents structurally: key order and whitespace are ignored, and arrays are matched by index. Each difference is listed on its own line with its JSON Pointer (RFC 6901) path: added, removed, changed (old → new) or type changed; the first line sums up the counts. 1 and 1.0 are treated as the same number.
+Which values are required?
Left JSON, Right JSON.
+Is my data stored?
No. All calculations run in your browser; the values you enter are never sent to or stored on a server. If you press “Save”, the calculation stays only in your own browser and you can delete it at any time.
+Is it free?
Yes, all tools are free and require no sign-up.
Similar tools
Popular Tools
Free Calculators in One Place
Tax, finance, health, math and more — 500+ tools, all in one place.