mkdiff

Practical guides

How to compare two JSON API responses before deployment

A safe workflow for comparing API JSON responses, formatting input, finding changed keys, and avoiding text-diff mistakes.

Updated 2026-06-03 · 6 min read

Why text diff can be misleading

API responses often change whitespace, property order, or formatting even when the data is equivalent. A plain text diff can make harmless formatting look like a large change.

MKDiff formats valid JSON before comparison. Keep Ignore object key order enabled to sort object properties recursively; array order and all field values still count.

Preserve IDs and verify the comparison rules

Paste or upload both responses and use Try sample JSON to see a large numeric ID change. MKDiff preserves the exact digits rather than converting numbers to JavaScript floating-point values. Numeric spelling still counts: 1 and 1.0 appear different.

Turn off Ignore object key order when property order matters to your review. A no-differences result applies to the selected rule; arrays are never reordered and no fields are automatically ignored. Resolve duplicate object keys before comparing. Each side supports up to 2 MiB of text, 100 nesting levels and 100,000 values. If comparison stops because there are too many differences, compare smaller sections.

Pre-deployment workflow

Capture the response from production and staging. Remove tokens, session IDs, and personal data before comparing.

Validate both JSON documents, format them, then compare. Focus on keys that changed meaning, not just timestamps or request IDs.

  • Validate syntax before comparing.
  • Normalize formatting so whitespace does not dominate.
  • For volatile fields such as requestId or timestamp, remove the same fields from both copies yourself; this tool does not exclude them automatically.
  • Document unexpected additions, deletions, and type changes.

What to inspect

Look for deleted fields, renamed keys, array order changes, and value type changes. These are the differences most likely to break clients.

If a value changed from number to string, null to object, or object to array, treat it as a compatibility risk.

FAQ

Should I use text diff or JSON diff for API responses?

Use JSON Diff when both inputs are valid JSON. It formats structure first, which makes changed keys, arrays, and nested values easier to inspect.

What should I do if one response is invalid JSON?

Run it through JSON Validator first. Fix syntax errors before comparing, otherwise the diff will reflect formatting failure rather than data changes.

Can I compare private API data safely?

For normal MKDiff workflows, pasted JSON is processed in the browser. You should still remove secrets, tokens, passwords, and user-identifying data before sharing screenshots or reports.