Overview / Developer & Code / JSON Diff
Developer & Code 100% In-Browser & Offline

JSON Diff

Compare two JSON documents and list every added, removed and changed value with its JSON Pointer path. Copy the result as text or as a JSON Patch.

Paste or type your input; results appear instantly and errors are shown below the input.

Your files and input never leave your browser – nothing is uploaded.

Objects are compared by key, so the order of keys never counts. Arrays are compared by position unless you ignore array order. With ignored order, a changed item shows as one removed and one added item.

Differences

    Limits: 2,000,000 characters per side. Numbers are read with JSON.parse, so integers beyond 2^53 lose precision. If a key appears twice in the text, the last value wins. The list shows the first 1,000 differences; the copy buttons use all of them.

    Paste two JSON documents, read the list of differences. /users/0/name changed, /email added, /role removed: each line names the exact place, so you do not have to scan two walls of braces by eye. This JSON diff compares the parsed data, not the text. Indentation and key order never show up as changes.

    Reading a JSON diff: path, kind, old and new value

    Every difference has four parts. The path is a JSON Pointer as defined in RFC 6901: /users/0/name is the key name of the first item in users. A key that contains a slash is written with ~1, a key that contains a tilde with ~0. The kind is added, removed, changed or type changed. Each kind has its own colour, a symbol (+, -, ~, !) and a text label, so the list works without colour vision. Then come the old and the new value.

    A summary line counts the kinds. If both sides hold the same data, you see "No differences" instead.

    Values longer than 200 characters are cut, with a note that tells how many characters are hidden. The button "Show full value" expands the value in place.

    Comparing two API responses step by step

    1. Paste the original into the left box and the changed version into the right box. Both boxes start with a sample, so you see a result before you type.
    2. Wait a moment. The tool compares 200 ms after your last keystroke. If a side is not valid JSON, the message names the side, the line and the column.
    3. Press Format both to pretty-print valid input, or Swap sides if you pasted the files the wrong way round.
    4. Switch on Ignore array order if the order of list items does not matter to you.
    5. Press Copy diff as text for one line per difference, or Copy as JSON Patch for a patch a program can apply.

    Key order, array order and number equality

    Objects compare by key, so {"a":1,"b":2} equals {"b":2,"a":1}. Arrays compare by index: [1,2,3] against [3,2,1] gives two changes, because the middle item is the same.

    With Ignore array order, the tool builds a canonical text for each element, with sorted keys, and matches equal elements as a multiset. Arrays nested inside elements are compared without order too. The price: an element that changed inside shows as one removed and one added item, not as a change inside the item.

    Numbers compare by value, so 1 and 1.0 are equal. A key with null is not the same as a missing key. An empty object against an empty array is a type change, and so is 1 against "1". Strings compare exactly, including case and spaces.

    Copying the diff as an RFC 6902 JSON Patch

    The patch turns the left document into the right one with add, remove and replace operations. Array items are removed from the highest index down and added from the lowest index up, so the operations work in the order given. There is no move or copy operation. In ignore-order mode the button is disabled, because a patch points at array items by position.

    Where your JSON goes, and what it cannot read

    Parsing and comparing run in your browser with JSON.parse. The tool sends no request and stores nothing; the network panel of your browser shows this. The clipboard is used only when you press a copy button.

    Each side may have 2,000,000 characters. Larger input is refused with a message. Numbers beyond 2^53 lose precision: 9007199254740993 is read as 9007199254740992, so two different huge integers can look equal. If a key appears twice in the text, the last value wins. Comments and trailing commas are not JSON, and the error shows their line and column. The list shows the first 1,000 differences; the copy buttons use all of them. A leading byte order mark is removed before parsing.

    Frequently asked questions (FAQ)

    Paste the original JSON into the left box and the changed JSON into the right box. The list of differences appears after a short pause. Each entry shows the path, the kind of change and the old and new value.