Skip to content
Toolew.com

JSON Diff

Compare two JSON documents semantically, ignoring key order, and get a change list, line diff and RFC 6902 JSON Patch.

Runs in your browser. Your data is not uploaded.
Loading tool…

Tool guide

What this tool does

JSON Diff compares two JSON documents by meaning rather than text, so reordered keys and different indentation do not count as changes. It lists added, removed, changed and type-changed values by path, can match array items by an ID key or ignore their order, and exports the differences as a report or a standard JSON Patch.

A plain text diff of two JSON files is noisy. Reformatting, a different key order or a serializer that writes keys alphabetically make every line look changed, while the one value you care about gets lost. Arrays are worse: when an item is inserted at the top, a positional comparison reports every later element as modified.

This tool parses both documents and compares them structurally. Objects are compared key by key regardless of order, values are compared by type and content, and every difference is reported with its JSONPath location. For arrays you can choose position-based comparison, matching objects by a key such as id, or treating the array as an unordered set. Options let you ignore case or surrounding spaces in strings and treat null as equivalent to a missing key. When arrays are compared by position, the differences are also emitted as an RFC 6902 JSON Patch that transforms the original into the changed document. All comparison runs locally.

How to use JSON Diff

  1. Paste the earlier version into Original JSON and the newer one into Changed JSON, or open files for each side.
  2. Under Compare arrays choose By position, Match objects by a key (and enter the key, such as id) or Ignore order.
  3. Switch on Ignore case in strings, Ignore spaces at the start and end of strings or Treat null the same as a missing key if those differences do not matter to you.
  4. Read the counters for Added, Removed, Changed and Type changed, then review the Changes table and filter it by kind.
  5. Open Line diff to see both documents with sorted keys side by side as a unified diff.
  6. Open JSON Patch to copy an RFC 6902 patch, or click Download report for a JSON list of every difference.

Tips for better results

  • Match objects by a key whenever array items have stable IDs; a single insertion then shows as one addition instead of a cascade of changes.
  • A Type changed entry, such as seats going from 10 to "25", often reveals a serialisation bug that a text diff would hide.
  • Use Treat null the same as a missing key when comparing APIs where one side omits empty fields and the other sends null.
  • Download the report to attach to a pull request or bug ticket; it lists each path with its before and after value.

Common use cases

  • Checking what changed between two versions of an API response after a deployment.
  • Reviewing configuration drift between staging and production JSON files.
  • Verifying that a data migration preserved every record and field.
  • Producing a JSON Patch to send as a PATCH request body.

Common mistakes to avoid

  • Comparing arrays of records by position when their order is not meaningful, which inflates the change count.
  • Expecting a JSON Patch when arrays are matched by key or unordered; patch paths depend on positions, so the patch is offered only for positional comparison.
  • Assuming 1 and 1.0 differ. Both parse to the same number in JSON, so they are reported as equal.

Frequently asked questions

Does key order affect the result?

No. Objects are compared key by key, so {"a":1,"b":2} and {"b":2,"a":1} are equivalent. The line diff view also sorts keys before comparing.

What is a JSON Patch?

JSON Patch (RFC 6902) is a standard list of operations such as add, remove and replace, each with a JSON Pointer path. Applying the generated patch to the original document produces the changed one.

How does matching by key work?

When every item in both arrays is an object with the chosen key, items are paired by that key’s value. Unpaired items are reported as added or removed, and paired items are compared field by field.

Can it compare large files?

Yes. Documents of several megabytes are parsed and compared in the browser, input is debounced while you type, and the change table shows the first 1,000 differences while the downloaded report contains all of them.

Related articles

Feedback & suggestions

Help us improve JSON Diff. We read every message.

Rating (optional)
Necessary
Required for security, language and theme preferences. Always on.