JSON diff (structural compare)
Paste two JSON (or YAML) documents and see the differences by structure: what was added, removed or changed, with the exact path. Key order does not matter. Export as JSON Patch.
Your data stays on your computer. Files are processed in your browser and are never uploaded.
Differences
How to use it
- Paste the two JSON documents into «JSON A» and «JSON B», or open them from files (YAML works too). «Load example» shows how it works, «Swap» exchanges the two sides.
- The comparison runs by itself. The order of object keys is always ignored; for arrays choose whether to compare by position, as sets or by key (for example «id»).
- If needed, ignore case in strings, set a tolerance for numbers (0.001 treats 1.0004 and 1 as equal) or exclude paths such as /meta/* or /**/updatedAt.
- Read the differences as a list (with filters by type) or as a merged tree where unchanged branches can be collapsed. «Next difference» and «previous» (F7 and Shift+F7) walk through the results.
- Export: copy the list as text or Markdown, or the JSON Patch (RFC 6902) that turns A into B. «Send to…» hands the result to another tool.
Frequently asked questions
How is this different from the text compare tool?
The text compare works line by line: if you reorder keys or change the indentation it reports everything as modified. Here both JSON documents are parsed and compared by structure: values and paths matter, formatting and key order do not.
How are arrays compared?
«By index» compares the first with the first, the second with the second and so on: inserting an item at the top shifts everything. «As sets» ignores order: two equal items are paired wherever they are, the others show as added or removed. «By key» pairs objects that share the value of a field (for example «id»): a move is not a change and you only see the fields that changed.
What is the array key and how is it detected?
It is the field that identifies an item. If you leave the field empty the tool tries «id», «_id», «key» and «uuid» and uses the first one present in every item with all-different values. If none fits, that array is compared by index. You can also type a field of your own.
How do I write the paths to ignore?
One path per line, as a JSON Pointer: /meta/updated. A path also ignores everything it contains. The * character stands for one level (/users/*/token), ** for any depth (/**/updatedAt). In names, «/» is written ~1 and «~» is written ~0.
Does the JSON Patch take the options into account?
No: it is always exact, meaning that applying it to A gives exactly B, even for values the options consider equal. Arrays are compared by index. Use it to apply the changes with a library that supports RFC 6902.
Can I compare YAML files too?
Yes. If the text is not valid JSON but is YAML with objects or lists, it is read as YAML (with «<<» merge keys). Text that starts with { or [ is always treated as JSON, so errors are the JSON ones.
Is my data sent anywhere? Are there limits?
No: the comparison runs in your browser and nothing is uploaded. With files of a few MB the work moves to a separate thread so the page does not freeze. The share link holds the texts in the address hash, so it suits small texts only.
Privacy
The comparison runs entirely in your browser: your JSON is never sent to any server.