Compare JSON values without getting lost in formatting changes
Reformat a configuration file and an ordinary text diff can light up almost every line. A structural comparison asks a more useful question: which values changed? It also has rules of its own, especially for arrays, where moving one item can produce several reported changes.
Object keys identify values; their written order is separate
RFC 8259 defines an object as an unordered collection of name/value pairs. These two documents have different text but the same name and count values. Online Tools JSON Diff reports no changes between them.
Try changing only the key order
Paste the first document into Before and the second into After. They are two separate inputs, not one valid JSON document when joined together. Formatting whitespace is also ignored by structural comparison. This does not mean the source bytes are identical: a file hash or signature may depend on those bytes.
{"name":"sample","count":2}
{"count":2,"name":"sample"}
Array positions carry meaning
An array is ordered. A ranking or sequence of tasks can change meaning when its items move, even if the same items remain. This tool compares each array position; it does not try to identify a moved object by its ID.
One insertion can produce several changes
A person may describe this as inserting green at the start. A position-based diff describes what occupies each slot. For records identified by an ID, choose a comparison that matches that ID. Sorting arrays before comparison hides order changes, so only do it when the data contract says order does not matter.
{"items":["red","blue"]}
{"items":["green","red","blue"]}
| path | kind | Before → after |
|---|---|---|
| /items/0 | changed | "red" → "green" |
| /items/1 | changed | "blue" → "red" |
| /items/2 | added | absent → "blue" |
Read the path as directions to a value
Result paths use JSON Pointer from RFC 6901. A slash moves down a level, and array indices start at zero. Property names containing a slash or tilde need escaping so they remain distinguishable from the pointer’s own syntax.
Pointers with special characters
A lone slash is not the empty pointer. The ~1 escape is also separate from URL percent-encoding such as %2F. Embedding a pointer in a URI fragment introduces another representation layer.
| Path | Target |
|---|---|
| Empty string | The entire document |
| /items/0 | The first item in items |
| /a~1b | The property named a/b |
| /m~0n | The property named m~n |
| / | The property whose name is an empty string |
Equal numbers can have different spellings
This tool preserves number tokens instead of first converting them to JavaScript Number. It treats 1, 1.0 and 1e0 as equal, while keeping a difference between adjacent large integers. That is this tool’s comparison policy, not a promise to make the input text identical.
Type changes still count
Passing the documents through an ordinary JSON formatter first may already round a large number and erase the difference. Use the original response text when checking precision.
| Before | After | Tool result |
|---|---|---|
{"n":1} |
{"n":1.0} |
No difference |
{"n":1} |
{"n":"1"} |
/n changed |
{"id":9007199254740992} |
{"id":9007199254740993} |
/id changed |
A change report is not an executable patch
The added, removed and changed rows are this tool’s report format. They are not JSON Patch operations with op, path and value fields. Use the report to locate a change, then make the update through the application’s supported configuration or API.
When comparison stops
Duplicate names are rejected instead of choosing one value silently. Each input is limited to 500,000 characters, nesting to 100 levels and results to 10,000 changes. Splitting a large document into related sections also makes it easier to connect a change to its purpose.
Try object order and array order separately
Start with the reordered object in JSON Diff, then compare the array example. For tabular records whose rows move, CSV Diff can match rows by a chosen key column.
Related reading and specifications
See JSON syntax errors and number precision for parsing issues. Structure is defined in RFC 8259 §1, pointers in RFC 6901 §§3–4, and executable JSON Patch operations in RFC 6902 §4.