Compare two JSON documents

This JSON diff tool parses two documents and reports added, removed, and changed values alongside their paths. It helps review API responses, application settings, and small test fixtures. Put the earlier document on the left and the newer document on the right, then press Compare. The before property holds the old value and after holds the new value. If either document is invalid, comparison stops with an error. The tool compares parsed values, so indentation, whitespace between tokens, and line wrapping do not create differences. Download the report when you need a record of the review.

Object order and JSON types

Object key order does not affect equality. The documents {"a":1,"b":2} and {"b":2,"a":1} compare as equal. A number such as 1 differs from the string "1", and a boolean false differs from the string "false". An absent property also differs from a property explicitly set to null. This distinction matters when reviewing optional response fields or configuration defaults. Removing a property produces a removed entry, while replacing its value with null produces a changed entry. String escapes are decoded before comparison, so a character and its equivalent Unicode escape compare equally.

Arrays are compared by position

Array order matters. Elements are matched by their zero based positions rather than by a record identifier. Comparing [1,2] with [2,1] therefore produces two changes. Inserting a record at the beginning may make every following position appear different. The tool does not detect moved records or calculate a minimal edit sequence. For comparisons based on identifiers, prepare both inputs using the same deliberate ordering or turn the identifiers into object keys first. That preparation depends on your data model; arbitrary sorting can hide meaningful order changes, and duplicate identifiers require an explicit handling policy.

Read JSON Pointer paths

Each path follows JSON Pointer notation. The path /users/0/name refers to the name field of the first item in the users array. A slash inside a property name is escaped as ~1 and a tilde as ~0, keeping a single unusual key distinct from multiple nested keys. A change to the root value has an empty string path. Added entries omit before; removed entries omit after. An omitted report property is different from a property whose value is null. The download is a JSON report for inspection, rather than an executable JSON Patch document.

Limits and numeric precision

Each document may contain up to 500,000 UTF-16 code units and 64 nesting levels. The report lists at most one thousand differences. When additional differences exist, truncated becomes true and the status explains that the list is incomplete. Do not treat a truncated report as an exhaustive change list. Duplicate object keys are rejected because different consumers can interpret them differently. Numbers that cannot be safely represented as JavaScript integers, or that contain more than fifteen significant mantissa digits, are rejected too. Encode precise decimal quantities and long identifiers as strings when their exact original value matters.

Example and local processing

Comparing {"active":true} with {"active":false,"name":"İpek"} produces a change at /active and an addition at /name. Copy the report or download it as a .json file. The tool does not merge documents or modify source files. Processing happens in your browser without sending document contents to a server. Sharing copies the page address by default; explicitly including inputs places small documents in the link fragment, where recipients can read them. Avoid using such links for secrets, customer records, or production credentials. User supplied content is displayed as text in the result field rather than interpreted as executable HTML.

Frequently asked questions

Does object key order count as a difference?

No. Object key order is ignored. Array order remains significant, so changing positions creates differences. Check whether the source uses an object or an array before interpreting the report as a change in business data.

Is null the same as a missing field?

No. A key absent from an object differs from a key explicitly holding null. Added and removed properties are reported separately, which helps identify changes to optional fields in an API contract.

Can I apply the output as a patch?

The output is an inspection report, not JSON Patch. It records old and new values but does not automatically merge documents or apply changes to files. Review changes against the rules of the receiving application.

Will every difference in a large document appear?

At most one thousand differences are listed. Additional changes set truncated to true and produce an explanatory status. Use a local command line workflow for larger reviews, and do not mistake a truncated report for an exhaustive change list.

Published: · Updated: