6 min read
How to Compare JSON Objects and Find Changes
Compare two pasted JSON documents, spot changed and missing values, and understand how key order and arrays affect a JSON diff.
Why a plain text diff is noisy
Two JSON documents can contain identical data but look completely different: one minified, one indented with tabs, another with four spaces. A raw text diff reports every whitespace change, hiding the one value that actually changed.
Normalize, then compare
Paste both complete JSON documents into JSON Diff, with a line containing --- between them. The tool parses each document, prints both with two-space indentation, then compares the resulting lines. Lines prefixed with - are from the first document; lines prefixed with + are from the second. In the example, the role changes, verified is added to the array, and enabled is added to the object. You can paste the contents of files, but this page does not upload or open files.
First document:
{"user":{"name":"Ada","role":"admin"},"tags":["engineering","active"]}
---
Second document:
{"user":{"name":"Ada","role":"editor"},"tags":["engineering","active","verified"],"enabled":true}Things that still show as differences
JSON.stringify does not sort object keys. For ordinary named keys, insertion order is preserved when the tool parses and prints the documents, so {"a":1,"b":2} and {"b":2,"a":1} produce different lines even though JSON objects are often treated as unordered. Integer-like keys follow JavaScript property ordering. Sort keys first if you want to ignore ordering differences.
Array order remains significant: moving an item appears as a difference. Nested objects are included in the line comparison; missing keys appear as added or removed lines, and values of different types print differently. The tool does not validate either document against a JSON Schema.
The tool accepts pasted text separated by ---. It has no file picker. For large documents, the comparison still runs in your browser and may take longer or use more memory as the input grows; there is no published size limit.
Comparing in code
In tests, prefer a deep-equality assertion (for example expect(a).toEqual(b) in Vitest or Jest) over comparing JSON strings, because it ignores key order and gives a structured diff.
Try the JSON Diff tool
Use the JSON Diff tool to compare two pasted documents. If the result shows many changes, first check whether key order or array order differs; the tool reports line changes and does not infer application-level equivalence.
