TsWorks Tools
All tools (39)

JSON Diff

Compare two JSON documents by structure, not by text.

Matches items by value instead of by index.

Differences

Paste JSON into both panes to compare them.

Key order and whitespace are ignored: only structural differences are reported.

Compare JSON by structure, not by text

A normal text diff of two JSON documents is mostly noise. Reorder the keys and every line changes; reformat the indentation and the whole file changes; neither is a difference in the data.

This parses both sides and compares the values. Key order and whitespace are ignored, and what you get is a list of exactly what was added, removed or changed.

Reading the output

Each line starts with + for added, - for removed or ~ for changed, followed by aJSON Pointer path such as /users/2/email: slash-separated, array indices as numbers, and the empty path meaning the document root.

The two options

  • Ignore array order matches array items by value rather than by index. Use it when an array is really a set - a list of tags, or records returned in whatever order the database felt like. Leave it off when position is meaningful, such as an ordered pipeline.
  • Ignore key case treats userId anduserid as the same field, which is useful when comparing output from two systems that disagree about casing.

Common uses

  • Finding what changed between two API responses.
  • Comparing config between staging and production.
  • Checking a migration produced the data you expected.
  • Reviewing a package-lock.json or similar generated file.

Related tools