JSON Diff & Compare
Paste two JSON documents to see exactly what changed — by structure, not by line. Broken or escaped JSON is repaired before comparing, and everything runs in your browser.
Tool input stays in your browserDid you know · Languages
JavaScript integers stay exact only up to 2^53 - 1, which is why large IDs arrive from APIs as strings.
Original (A)
you edit0 lines · 0 BChanged (B)
you edit0 lines · 0 BDifference
read onlyA semantic diff, not a text diff
A plain text diff reports a change whenever a key moves or the indentation shifts. This tool parses both documents first and compares the resulting values, so reordered object keys and reformatted whitespace are never reported as differences. Each side is then re-printed with matching indentation so the two panes line up row by row.
Arrays get special treatment. Instead of comparing index against index, identical elements are anchored with a longest-common-subsequence pass, so inserting one item at the top of a list marks a single insertion rather than rewriting every element below it. Elements that only partly match — same identifier, different values — are paired up and compared field by field.
Comparing JSON that is not valid yet
Real payloads rarely arrive clean. One side comes from a log where every quote is escaped as \"key\", the other was hand-edited and has single quotes, unquoted keys, and a trailing comma. With Auto-fix broken JSON enabled, each pane is repaired before the comparison runs and the repairs applied are listed under the editor, so you can see exactly what was altered. Press Fix & format both to write the cleaned, indented version back into the editors.
The repair pass handles, among others:
- Backslash-escaped quotes, newlines, and tabs from log output
- JSON that is double-encoded as a string inside another string
- Missing opening or closing braces on truncated lines
- Trailing commas, comments, single quotes, and unquoted keys
- Python and JavaScript literals such as
None,True, andNaN
Controlling what counts as a difference
Two responses are often equivalent for your purposes even when they are not byte identical. The compare options let you say so:
- Ignore array order compares lists as unordered collections, so a reshuffled array of tags is identical.
- Loose types treats
"42"and42as equal, which is useful when one service serializes numbers as strings. - Ignore case and Trim strings normalize string values before comparing.
- Ignore keys drops noisy fields such as
updatedAtorrequestIdfrom both sides so they never show up as changes.
Four ways to read the result
Side by side aligns both documents with insertions, deletions, and edits colour-coded, and highlights the changed part inside each edited line. Unified collapses that into a single column of + and - lines that pastes cleanly into a pull request or ticket. Changes lists every differing path with its old and new value, filterable, with one-click path copying. Patch emits an RFC 6902 JSON Patch that transforms the left document into the right one, ready to send to an API that accepts patch documents.
Turn on Only differences to collapse long identical stretches, and use the up and down arrows to jump between changes in large documents.
Why it is private
Parsing, repairing, and comparing all run as JavaScript inside this page. Open your browser DevTools, switch to the Network tab, and paste a document: no request carries the document. That matters when you are diffing API responses that contain tokens, customer records, or internal identifiers.
JSON Diff FAQ
Answers for JSON diff, JSON compare, JSON Patch, and comparing two JSON files in the browser.
What is a JSON diff?
A JSON diff compares two JSON documents by structure and values, not by raw lines. Key order and whitespace are ignored so a minified payload and a pretty-printed copy of the same object show as equal. This JSON compare tool highlights added, removed, and changed paths and can export an RFC 6902 JSON Patch.
How do I compare two JSON files online?
Paste the left and right JSON (or open two files) on this JSON diff page. Broken or escaped JSON can be repaired first. The side-by-side view shows inserts and deletes; Unified is a single column; Changes lists every path; Patch emits JSON Patch operations. Nothing is uploaded.
What is a JSON Patch?
JSON Patch (RFC 6902) is a list of operations (add, remove, replace, move, copy, test) that transform one JSON document into another. This JSON diff generator builds that list from the two documents you paste so an API that accepts application/json-patch+json can apply the same edits.
Why is line-based diff wrong for JSON?
A text diff treats reformatting as a change: wrapping an object or sorting keys looks like a rewrite even when the data is identical. A semantic JSON diff canonicalizes values first, so only real data changes appear. Use this JSON compare tool when reviewing API responses, not git line diffs of minified files.
Can I ignore keys like updatedAt in a JSON compare?
Yes. Ignore keys drops named fields on both sides before comparing, which is useful for timestamps, request ids, and other noise. Loose types can treat the string "42" and the number 42 as equal. Those options live in this JSON diff tool and never leave the browser.
Is this JSON diff private?
Yes. Parsing, repair, and comparison run as JavaScript in this tab. Open the Network panel and paste documents: you should see no request. That matters when the JSON contains tokens or customer records.