JSON Diff
Compare two JSON documents structurally and list every added, removed and changed value by path.
How to use this tool
Steps for using the JSON Diff.
- Paste the earlier version into Original JSON and the newer version into Modified JSON, or click Sample. The comparison updates as you type; if a side is not valid JSON, its error is shown with the line and column.
- Set the comparison options: Ignore array order for lists whose order does not matter, Match items by a property such as
idso reordered or inserted objects are compared with their counterpart, and Ignore keys such asupdatedAt, etagto skip noisy fields. - Changed lines are highlighted right inside both editors — red for removed, green for added, amber for changed (turn this off with Highlight in editors).
- Read the counts in the status bar, then use the Changes view: filter by added, removed, changed or type changed, search by path, copy any JSONPath such as
$.env.LOG_LEVEL, or click the target icon to jump both editors to that change. - Switch to Visual for a merged, colour-coded view of both documents (with unchanged lines collapsed), or to JSON Patch for an RFC 6902 patch that turns the original into the modified document.
- Use Swap to reverse the direction, Format both to pretty-print the inputs, and Copy, Download or Expand to keep the current view.
Example
Changed, removed and added values
Original: {"id": 7, "tags": ["a", "b"], "price": 10}
Modified: {"id": 7, "tags": ["a"], "price": "10", "sale": true}- $.tags[1]: "b"
~ (type) $.price: 10 → "10"
+ $.sale: trueCommon use cases
- Comparing API responses between staging and production, or before and after a deploy.
- Reviewing what changed between two versions of a configuration file or feature-flag set.
- Debugging failing snapshot tests by seeing exactly which fields differ.
- Spotting unintended type changes, such as an ID that switched from number to string.
- Writing release notes or migration guides for a changed JSON API contract.
How the structural JSON diff works
A text diff compares lines, so reordering keys or reformatting a file shows up as a wall of changes even when the data is identical. This tool parses both documents first and compares the resulting values, so whitespace, indentation, key order and number spelling (1 versus 1.0) never count as differences. Only changes to the data itself are reported.
The comparison walks both values together. For objects, keys present only in the original are removed, keys present only in the modified document are added, and shared keys are compared recursively. Arrays are compared position by position: element 0 with element 0, and so on, with extra elements at the end reported as added or removed. When two values at the same path are both scalars but differ, the change is changed; when the JSON type differs — a number that became a string, or an object that became an array — it is type-changed, a common source of client bugs that is easy to miss in a text diff.
Every change is reported at the deepest path where the documents differ, written in a JSONPath-like form: $ is the root, .name is an object key and [0] an array index. Keys that are not simple identifiers are quoted, as in $["first name"]. Values are shown as JSON, and long values are shortened in the list (up to 120 characters) so the report stays readable.
Because arrays are compared by index, inserting an element at the start of an array reports every following element as changed, plus one added element at the end. That is accurate for ordered data but noisy for lists where order does not matter; sort both arrays the same way before comparing if you only care about membership.
Limitations
- Arrays are compared by index, not by matching similar items, so insertions near the start produce many changes.
- The list shows the first 1,000 changes; the copied or downloaded report contains all of them, with long values truncated to 120 characters.
- Numbers are compared after parsing, so integers beyond 2^53 − 1 that differ only in the last digits may compare as equal.
- Each input is limited to 2 million characters.
Frequently asked questions
Does key order matter?
No. JSON objects are unordered, so {"a":1,"b":2} and {"b":2,"a":1} are identical here. Array order does matter, because arrays are ordered in JSON.
What is a type change?
The value at a path changed its JSON type — for example from number 2 to string "3", or from null to an object. It is reported separately from an ordinary value change because it often breaks typed clients.
How is this different from a text diff?
A text diff shows line-by-line edits, including whitespace and reordering. This tool compares the parsed data, so formatting-only edits produce no output and every reported change is a real data change with an exact path.
Can I see the diff as a JSON Patch?
Not directly. The report uses paths like $.items[0].price; to build an RFC 6902 JSON Patch, convert each path to a JSON Pointer such as /items/0/price and use add, remove or replace operations.
Is my JSON sent anywhere?
No. Both documents are parsed and compared in your browser and are never uploaded.