Skip to content

JSON Diff Viewer

Compare two JSON documents with semantic diff highlighting and detailed change detection.

JSON Diff Viewer tool

Loading...

Example

Input: JSON A {"name":"Ada","age":36} and JSON B {"name":"Ada","age":37,"admin":true}

Result: 2 differences: Added $.admin (true); Changed $.age (36 to 37)

The documents are compared as data, so key order does not matter. Each difference is listed by its JSONPath location.

How Differences Are Reported

JSON AJSON BResult
{"a":1,"b":2}{"b":2,"a":1}Identical
{"n":1}{"n":1.0}Identical
{"n":1}{"n":"1"}changed $.n
{"x":null}{}removed $.x
{"u":{"roles":["a"]}}{"u":{"roles":["a","b"]}}added $.u.roles[1]
{"first name":"A"}{"first name":"B"}changed $["first name"]
[1,2,3][0,1,2,3]changed $[0], $[1], $[2]; added $[3]

Output of this viewer's semantic comparison.

  1. Paste the first JSON document into the JSON A panel.
  2. Paste the second JSON document into the JSON B panel.
  3. The tool performs a semantic comparison as you type and shows the total number of differences, or confirms the documents are identical.
  4. Review the Changes by Path list, where each added, removed, or changed value is labeled and color-coded with its old and new value.
  5. Scroll to the Line Diff to see both documents line by line with added lines in green and removed lines in red.
  6. If a document is not valid JSON, fix the error shown under its panel - until then the tool falls back to a plain text line diff.

Comparing JSON by Structure, Not Text

A JSON diff compares two documents as data rather than as lines of text. This viewer lists every value that was added, removed or changed, each with its JSONPath location such as $.user.roles[1]. Differences in key order and whitespace are ignored.

A plain text diff flags a change when keys are reordered or the indentation differs, even though the data is the same. Here both documents are parsed, their keys are sorted, and the values are compared. {"a":1,"b":2} and {"b":2,"a":1} are reported as identical. A change of type does count, though: 1 and "1" are different values, while 1 and 1.0 are the same number.

Arrays are compared position by position. That is simple and predictable, but it has a side effect. Inserting one item at the start of a list shifts everything after it, so each later position shows as changed and the last one as added. Keep that in mind when you compare lists of records. The table shows how common cases are reported.

Results update as you type. The Changes by Path list shows up to 500 differences with the old and new values; added entries are green, removed ones red and changed ones amber. Below it, a line diff shows both documents after key sorting. If either side is not valid JSON, the error appears under that panel and the tool falls back to a plain text diff. For ordinary text, use Text Diff and Compare.

Sources

Frequently Asked Questions

No. JSON objects are unordered by definition, so both documents have their keys sorted before comparing. Two objects with the same keys and values in a different order are reported as identical. Array order does matter, because arrays are ordered lists.
Arrays are compared by position: item 0 with item 0, item 1 with item 1, and so on. If you insert a new item at the front, every item moves along one place, so each position now holds a different value. To compare lists of records, sort both arrays the same way first, for example by ID.
No. A number and a string are different JSON types, so the change is reported, which is often exactly the bug you are looking for. Numbers are compared by value, though, so 1, 1.0 and 1e0 are all equal.
No. {"x": null} has a key x whose value is null, while {} has no key x at all. Comparing the two reports removed $.x. Many APIs treat these cases differently, for example null to clear a field versus a missing key to leave it unchanged.
The semantic comparison needs both documents to parse. If one does not, its error is shown under that panel and the tool falls back to a plain line-by-line text diff, so you still see what changed. Fix the error to get the list of changes by path.

Related Tools

JSON Formatter and Validator

Format, validate, beautify, and minify JSON data with a collapsible tree view and line-and-column error detection.

Developer Tools

JSON Minifier

Minify JSON by removing whitespace and formatting for compact, production-ready output.

Developer Tools

JSON to YAML Converter

Convert JSON documents to YAML format with syntax validation, clean formatting, and instant preview.

Developer Tools

JSON to CSV Converter

Convert a JSON array of objects to CSV with automatic column headers, and convert CSV back to JSON in the same tool.

Developer Tools

JSON to XML Converter

Convert JSON data to well-formed XML documents with customizable root element and formatting options.

Developer Tools

JSON to TOML Converter

Convert JSON objects to TOML format with type preservation and clean table structure output.

Developer Tools