Small Tools
JSON utility

JSON Diff

Compare two JSON documents and inspect their values.

● This tool runs entirely in your browser. Your input is never uploaded to our servers.
Output
Your result will appear here…

How to use JSON Diff

  1. Paste the first JSON document.
  2. Add a line containing only --- (three hyphens, nothing else) below it, then paste the second document.
  3. Select Compare and read the − and + lines.

Example

Input / settings:

{"name":"Ada","role":"engineer"}
---
{"name":"Ada","role":"designer"}

Output:

  {
    "name": "Ada",
−   "role": "engineer"
+   "role": "designer"
  }

Both sides are re-serialized before comparison, so indentation and spacing in the pasted text never appear as differences.

When to use

Overview

JSON Diff parses two JSON documents, re-serializes each with two-space indentation, and compares the results line by line. Matching lines start with two spaces; where a line differs, the first document's line is marked − and the second document's line is marked +. This is a text comparison of normalized JSON, not a structural diff, so it does not track which key moved or which array element was inserted.

Supported input

Two strict JSON documents (RFC 8259) separated by a line containing only ---. Only the first two documents are compared.

Output details

The first document is compared with the second line by line after both are re-serialized with two-space indentation. Changed lines are marked − and +.

Common mistakes

Practical tips

Privacy and security

This tool runs entirely in your browser. Your input is never uploaded to our servers. Parsing uses your browser's JSON.parse, so error wording for invalid JSON can differ between browsers. If a document repeats a key, the last value wins, so {"a":1,"a":2} is compared as {"a":2}; RFC 8259 calls the behavior of repeated names unpredictable, so avoid relying on it.

References

Frequently asked questions

How do I separate the two JSON documents?

Put --- alone on its own line between them, with no spaces around it and not at the very start or end of the input. Without a recognized separator the tool asks you to add one.

Are number formats such as 1 and 1.0 reported as different?

No. Both parse to the same number and serialize as 1, so formatting differences in numbers are not shown.

Can I compare JSON with comments or trailing commas?

No. The input must be strict JSON as defined by RFC 8259, so comments and trailing commas are reported as parse errors.

Related tools