JSON

JSON Diff

Paste two JSON documents to see exactly what was added, removed or changed, by path. Key order is ignored, and you can also generate an RFC 6902 JSON Patch.

Guide: Compare Two JSON Files: Find Differences and JSON Patch

Ready. Paste JSON into both boxes.

ChangePathBeforeAfter

What it does

The comparison is by value, not by text: the order of keys in an object does not matter, and formatting is ignored. Each difference is listed with its path (for example $.user.tags[2]), the old value and the new value.

Arrays

  • Compare by position matches items with the same index. Extra items are reported as added or removed.
  • Ignore order treats arrays as collections and reports only the items that exist on one side. Use it for lists where order carries no meaning.

JSON Patch

In position mode the tool also writes a JSON Patch (add, remove and replace operations) that turns the original document into the changed one, ready for APIs that accept PATCH requests.

Example

These two documents list their keys in a different order, so a text comparison would mark almost every line:

Original: {"user":{"name":"Ada","tags":["a","b"],"age":36},"id":1}
Changed:  {"id":1,"user":{"age":37,"name":"Ada","tags":["a","b","c"]},"active":true}

The tool compares values instead and reports exactly 3 differences (2 added, 1 changed):

  • added $.user.tags[2]: "c"
  • changed $.user.age: 36 to 37
  • added $.active: true

In position mode it also writes the matching JSON Patch, which you can send to an API that accepts PATCH requests:

[
  { "op": "add", "path": "/user/tags/2", "value": "c" },
  { "op": "replace", "path": "/user/age", "value": 37 },
  { "op": "add", "path": "/active", "value": true }
]

Compare by position or ignore order

Take {"a":1,"l":[1,2,3]} and {"a":"1","l":[3,2,1]}. Compared by position there are 3 differences: the number 1 became the string "1" (reported as a type change), and the list items at index 0 and 2 changed. With Ignore order the two lists count as the same collection, so only the type change remains. Ignoring order is right for tags or IDs where position means nothing, but the JSON Patch is not available in that mode, because a patch needs exact positions.

Frequently asked questions

Is the order of keys a difference?

No. The comparison is by value, so key order and formatting are ignored.

How is this different from the text diff?

The Text Diff Checker compares lines of text. This tool understands the structure of JSON, so reformatting or reordering keys does not create noise, and each difference has a path.

What is a type change?

A value that keeps its place but changes type, for example the number 1 becoming the string "1". It is counted separately from a normal change.

Is my JSON uploaded?

No. The comparison runs in your browser.

Privacy

This tool runs entirely in your browser. What you enter is processed on your device and is not sent to a server.

Share this tool

Your data is not included in this link.