Compare JSON while ignoring object key order

Two JSON objects can be equivalent even when their properties appear in a different order. A raw text diff treats that harmless reordering as a change; a semantic diff does not.

Objects and arrays follow different rules

Object property order is not semantically meaningful, so properties should be matched by name. Array order usually is meaningful, so values should remain tied to their index unless the application defines a separate identity rule.

Flatten values into stable paths

Paths such as $.customer.address.city or $.items[2].price provide a stable coordinate for every primitive value. Comparing those coordinates reveals additions, removals, and value changes without noise from indentation or key order. For example, {"name":"Ada","role":"analyst"} and {"role":"analyst","name":"Ada","active":true} share the first two paths and add $.active. Text files loaded from disk are limited to 10 MB and the displayed result is capped at 10,000 differences.

  1. Parse both documents first.
  2. Sort object keys deterministically.
  3. Preserve array indexes.
  4. Compare the value at each resulting path.

Know when preprocessing is required

Generated timestamps, request IDs, and unordered arrays may need an explicit ignore or sorting rule. Apply those rules before comparison and document them; otherwise the result cannot be reproduced.

Sources

Private by design

Runs in your browser

Content is processed in your browser and not sent to the application server

Works without an account