Compare JSON
Compare two JSON documents by value, key order ignored, and get a JSON Patch. Free, with no account or uploads.
Paste two JSON documents to compare them
Changes are found by value, not by line: moving a key is not a change, and numbers are compared exactly.
More transformations
Sorting changes key order recursively, preserving array order. Repair can add or remove content; review its preview. Redaction matches exact property names, ignoring case, and does not guarantee every secret is removed.
Add valid JSON to explore its structure.
JSONPath: $.users[*].name, $..id, $.users[0:2], or $.users[?@.role == "editor"]. JSON Pointer: /users/0/id; ~1 means / and ~0 means ~. Values retain exact numeric text. Filters require safe numbers.
Object key order is ignored; arrays compare by position; numbers compare exactly. The patch transforms source into comparison, with at most 500 changes.
Add, remove, replace, move, copy and test are supported. Failures leave the source intact. Removing the root is rejected because it would leave no JSON document.
Draft-07, 2019-09 and 2020-12 (default). Email, URI and date-time format checks. Local $ref/$defs work; remote references are never fetched. No coercion, defaults or removed values. Up to 100,000 schema characters; operations stop after 20 seconds.
CSV/table view need an array of objects. CSV imports keep cells as strings. YAML aliases, merge keys, custom tags and non-string keys must be expanded or converted first. Types/schemas describe one sample and need review.
Source, comparison and schema text stay in this tab and clear on refresh. Files are not uploaded. The editor never runs pasted JavaScript. Cancel stops the worker without changing your source.
A little help along the way
Say what you want to do: make it readable (Edit, to format or repair), look through it (Explore), turn it into CSV or YAML (Convert) or compare two (Compare). The page says at once whether your JSON is valid. Under More options every workflow has its tab, with Query to select data and Schema to check a contract. Results stay separate until you choose Use result as source.
Questions people ask
- Does moving a key count as a change?
- No. Objects are compared by their values, so the same keys in another order are the same. Arrays are compared position by position, and numbers are compared exactly.
- What is the JSON Patch it gives?
- A list of operations (add, remove, replace) in the RFC 6902 format that turns the first document into the second. You can preview applying a patch to your source before using it.
- How do I compare two files?
- Open or paste the first in Your JSON and the second in Comparison JSON, then press Compare JSON. Swap documents turns the comparison the other way round.
This page is the JSON formatter, opened for this one job; every other tool it has is one press away. Each of its settings is explained on the JSON formatter's own page.
Keep going
Guides
- Compare two JSON files, ignoring key order
- Is it safe to paste JSON into an online formatter?
- Why is my JSON invalid? Common errors and how to fix them
- How to convert JSON to CSV and open it in Excel
- Convert CSV to JSON online without uploading it
- JSON formatter and validator online, free, no login
- JSONPath tester online, with examples and JSON Pointer
- Repair broken JSON online, with a preview