JSON Diff: Compare Two JSON Files Online

Original JSON
Changed JSON

Paste, format, and compare two JSON snippets side-by-side. Validation, pretty-print, and minify built in.

What is the JSON diff tool?

The JSON diff tool puts two JSON documents side by side and highlights every character that differs. Last week's payload goes in the left pane, today's in the right. Your JSON stays in the tab unless you press Share.

It uses your browser's native JSON.parse for validation. There's a Format button when your JSON is one giant minified line, a Minify button for the opposite case, and live validation that flags syntax errors as you type.

If you've ever stared at a 6,000-line openapi.json diff in a GitHub PR and tried to find the one field that broke a downstream client, this page was built for that hunt: format both sides, sort the keys, and the field that changed is usually the only thing left highlighted. For prose or anything that is not JSON, use the plain text compare tool on our main page.

How the JSON diff works

Lines are paired first, then each edited pair is compared character by character, with a cleanup pass that moves the highlight onto whole values and keys instead of stray quotes and commas. Added text is green in the right pane, removed text red in the left.

JSON has its own quirks the spec calls out. The JSON specification in RFC 8259 defines objects as unordered, so reordering keys is technically a no-op even though a text diff will flag it. That is what the Sort keys button is for: it puts the keys of every object, at every depth, in alphabetical order on both sides at once. Format on its own keeps keys in the order you pasted them. For deeper structural work, take a look at JSON Patch (RFC 6902) or the simpler JSON Merge Patch format (RFC 7396), which are the two standard ways to describe a JSON change as data.

When ordering matters for hashing or signing, RFC 8785 (JSON Canonicalization Scheme) is the relevant spec. Sort keys, normalise number formatting, then diff.

How to compare JSON

Paste, format, read. There is no signup, and the diff never round-trips through a server.

  1. 1

    Paste or upload your JSON

    Paste the old JSON on the left, the new JSON on the right. Or click Upload on either side to load a .json file from disk. Sample loads a small pair of JSON objects if you want to try it before pasting your own.

  2. 2

    Format both sides for a fair comparison

    Click Format on each pane to pretty-print with two-space indentation. This normalises whitespace and line breaks so the diff highlights actual data changes, not formatting differences. The validation badge turns green when your JSON parses cleanly.

  3. 3

    Read the diff

    Removed text is shaded red in the left pane, added text green in the right. Scroll one pane and the other keeps pace, and each pane header shows how many changes it holds.

Real jobs for a JSON diff

Auditing IAM policy changes before apply

Paste the current aws iam get-policy-version output against the proposed JSON to see exactly which Action entries were added, or whether someone slipped "Resource": "*" into a previously specific statement. Policies pulled back out of AWS often list keys in a different order than the file you wrote, which makes a GitHub diff misleading; press Sort keys here and only the real change is left. Statements that swapped places in the array still show, because array order is data.

Spotting silent Terraform plan drift

When terraform show -json tfplan returns a 4 MB blob, eyeballing it is hopeless. Diff today's plan against yesterday's to surface the aws_security_group_rule someone added under a refactor PR or the lifecycle.ignore_changes block that quietly disappeared.

Reviewing OpenAPI schema changes pre-merge

A 6,000-line openapi.json diff is unreadable when a code generator reorders paths alphabetically. Press Sort keys, compare, and the actual change surfaces: a required field added to CreateOrderRequest, or a 200 response whose schema quietly switched from string to string | null.

Debugging package-lock.json after a merge

After resolving a package-lock.json conflict, diff your resolved file against main's lockfile to catch a transitive downgrade. npm sometimes resolves the same semver range to different exact versions across machines, which is the actual cause of "works on my machine, fails in CI". Read the package-lock.json docs for what each field means.

Comparing Elasticsearch mappings across environments

Pull GET /my-index/_mapping from staging and prod, drop both into the diff. Prod might still have "type": "text" on a field that staging migrated to "keyword" last sprint, which is why the aggregation query returns nothing in prod and works locally. Mappings nest five or six levels deep and a text diff buries this in noise.

Reproducing flaky API mocks

When a Playwright test passes locally and fails in CI, capture the JSON response body the test actually saw and diff it against the fixture in your repo. Often it's a createdAt timestamp or a traceId field that nobody pinned, and after Format and Sort keys the offending key is one highlighted line instead of a wall of formatted text.

JSON quick reference

The JSON rules behind most surprising diffs, each one taken from RFC 8259 or from how JSON.parse behaves.

TopicWhat this tool does
Object key order Unordered per the spec. {"a":1,"b":2} equals {"b":2,"a":1}. Use Sort keys to normalise before diffing.
Array order Ordered. [1,2,3] is not equal to [3,2,1]. Sort manually if order does not matter for your use case.
Trailing commas Not allowed. { "a": 1, } is a parse error in standard JSON. Allowed in JSON5/JSONC, which are supersets. Strip them first.
Comments Not allowed. // like this is a parse error. JSON5 and JSONC accept them; this tool follows the strict RFC 8259 grammar.
Numbers Parsed as 64-bit IEEE 754 floats. 0.1 + 0.2 = 0.30000000000000004. Integers above 2^53 − 1 lose precision; store snowflake IDs as strings.
Duplicate keys The spec calls them undefined behaviour. Most parsers keep the last occurrence. The diff shows all of them, which is usually what you want when auditing config files, but Format and Sort keys parse the JSON first and keep only the last.
Encoding UTF-8 only. RFC 8259 forbids a UTF-8 BOM at the start of the document; some parsers accept it anyway, but the spec does not.
Null vs missing A key with value null is present. A missing key is absent. Different from JavaScript's undefined, which has no JSON representation.

Questions about comparing JSON

Does this save or upload my JSON anywhere?

Only if you press Share. Comparing, formatting and validating all happen in this tab, and none of it sends your JSON anywhere. Paste an internal API response or an IAM policy, close the tab, and no copy survives. Share is the deliberate exception: it stores both sides on our servers so the link can open for someone else. Want proof for the rest? Keep an eye on the requests DevTools lists during a compare; none of them contain your JSON.

Will key reordering or pretty-printing JSON show up as a change?

Yes, both do. A text diff compares characters line by line, so reformatting, key reordering, or whitespace changes show up as differences even when the data is identical. Click the Format button on both panes to pretty-print first, and the diff focuses on real data changes. To stop key order showing up at all, press Sort keys, which reorders the keys on both sides in one go.

Does the order of keys in a JSON object matter?

For object keys, no. The JSON spec says objects are unordered, so {"a":1,"b":2} and {"b":2,"a":1} represent the same data. A character diff will still flag the reorder, which is why there is a Sort keys button: it puts every object's keys in alphabetical order on both sides. Arrays are different: [1,2,3] and [3,2,1] are not equal because array order is meaningful in JSON.

Why does 0.1 + 0.2 not equal 0.3 in my diff?

Because IEEE 754 floating-point. 0.1 + 0.2 is actually 0.30000000000000004, and JSON.parse reads numbers as 64-bit floats. Big integers hit the same limit: anything past 2^53 - 1 (9007199254740991) loses precision, so a Twitter-style snowflake ID won't round-trip. If precision matters, store those as strings.

Can I paste JSON with comments or trailing commas?

Standard JSON does not allow either. { "a": 1, } or // comment will give you a parse error. That's JSON5 or JSONC (the format VS Code uses for settings.json), which is a superset. Strip the comments and trailing commas first. We follow the strict RFC 8259 grammar on purpose so the diff matches what your API actually accepts.

How big a JSON file can I diff before it gets slow?

Up to a few MB is fine, sub-second. Past 10 MB the browser starts to feel it, mostly because rendering the diff (not computing it) is what gets expensive. For 50 MB+ exports, trim each side down to the branch you need with jq, then paste that.

Why does my VS Code settings.json fail to parse here?

Because settings.json and tsconfig.json are JSONC, not strict JSON. JSONC allows // line comments, /* block comments */, and trailing commas; strict JSON per RFC 8259 forbids all three. JSON5 goes further with single-quoted strings, unquoted keys, and hex literals. Strip the comments and trailing commas before pasting if you want a clean diff. If you keep both sides as JSONC, the parser-strict view of the diff is more useful anyway, since that's what your API consumer will actually accept.

How do you handle JSON numbers above 2^53?

You probably already lost precision before the diff ran. JSON has no integer type; everything is an IEEE 754 double. Numbers above Number.MAX_SAFE_INTEGER (2^53 − 1 = 9,007,199,254,740,991) round to the nearest representable double when parsed. Twitter snowflake IDs, Discord snowflakes, and Stripe object IDs ship as quoted strings for exactly this reason. If both sides are valid JSON, the precision loss happens identically on both, so the diff itself is faithful, but the displayed value may not match the source bytes. For ground-truth comparison of large IDs, quote them as strings or compare the raw text without JSON-parsing first.

Do I need an account to use the JSON diff?

No. Formatting, sorting keys, validating and comparing all work without signing in, and there is no cap on how many payloads you compare. The site is paid for by ads. An account only adds a list of the comparisons you have shared, so you can find or delete those links later. What you copy or download is your JSON as it sits in the pane, nothing added.

Why use this instead of another online JSON diff site?

Mainly because your JSON stays in the browser. Many JSON diff sites POST both sides to a server before comparing, which rules them out for an internal API response or a config with secrets in it. Here only the Share button sends anything. The highlight also sits on the changed value inside a line, so one edited field in a 200-line object is easy to find, and Format, Minify, Sort keys and live validation are built in.

Can it compare two JSON files instead of pasted text?

Yes. Each pane has an Upload button that opens a .json file from disk, so last week's export can go on the left and today's on the right without any copy-paste. The file is read locally in the browser and never sent anywhere. Press Format on both sides so the indentation matches, and only the values that changed stay highlighted.

Can I compare more than two JSON files at once?

Not in one view. It is built for two sides, original and changed, because that is what a diff is. If you have three config versions, compare them in pairs: staging against prod, then prod against the proposed change. Each pair gives you a clean, focused result instead of a three-way merge view that hides which file introduced a given key.

Is it safe to paste an API response with tokens or keys?

Yes, as long as you leave the Share button alone. Parsing, formatting and diffing happen on your machine, with nothing uploaded, logged or stored. A pasted JWT, API key or customer record lives in the tab and disappears when you close it. Share is different because it saves both sides on our servers, so never share a payload that still holds a live token. If you want to check, search the DevTools network log for your token after a compare; it never shows up.

Can ChatGPT compare two JSON files?

It can summarise what changed between two JSON snippets, and for a quick "what moved here?" that is handy. But a language model is not a parser. It may silently reorder keys, miss a value buried deep in a nested object, or trip on integers past 2^53 where precision is already gone. And you are pasting the JSON, tokens and all, into a third-party service. For an exact, character-level compare that runs in your browser, run it through this tool first, then hand the short result to ChatGPT and ask it to explain the impact in plain English.

Privacy: where your JSON goes

Your JSON stays on your machine while you compare. The parser, formatter, and diff all run locally, and the only time it travels is when you click Share, which stores both sides on our secure servers until the link expires. We do not log or measure what you paste. Parsing uses the browser's native JSON.parse, and the JSON spec we follow is RFC 8259.