LocalOps Studio free browser tools

How-to guide · JSONSmith

How to format and diff JSON when debugging APIs

"What changed between the last working request and this one?" is the most common debugging question for integrations. This guide covers formatting, minifying, and diffing JSON and YAML payloads - including why you should do it locally when the payload contains tokens.

Updated 2026-10-25 Local-first No upload

Why paste JSON into a local tool

Real debugging payloads are full of things you should not ship to a random website: bearer tokens, customer IDs, internal URLs. Yet the reflex when a payload looks broken is to paste it into the first formatter Google shows.

A local formatter is that tool without the upload. Parsing, formatting, and diffing happen in your browser, so the reflex becomes harmless.

Format and minify in one workflow

  • Format - pretty-print minified JSON or YAML so you can read the structure and find the missing comma.
  • Minify - compact JSON for transport or for pasting into a request body.
  • Validate - catch invalid syntax with a clear error instead of silent failure.

Diffing webhook and API responses

Paste the old payload on the left and the new one on the right, and the diff highlights the differing lines - no eyeballing two editor panes side by side. Both inputs can be JSON or YAML; formatting is applied consistently before comparison.

This turns "something changed in the webhook" into "line 14 of the config object changed," which is where real debugging starts.

A safe debugging routine

  1. Copy the payload from the failing request or webhook.
  2. Paste it into a local JSON tool - it formats, validates, or diffs instantly.
  3. Review the output and fix the issue, keeping secrets on your machine.
  4. If you must share a snippet, redact tokens first and paste only the relevant subtree.

Common JSON debugging mistakes

The first is diffing two minified payloads. When every key is on one line, the diff either shows one enormous changed line or nothing useful. The second is ignoring type changes: 1 and "1" can produce the same-looking diff but behave differently in an application.

The third is pasting production payloads into a public formatter. Webhook bodies often contain customer data, access tokens, and internal IDs. A local tool avoids the upload, but you should still redact before sharing the result in a ticket.

Pre-flight checklist

  • Redact tokens, emails, and customer identifiers.
  • Format both sides with the same settings.
  • Validate the syntax before diffing.
  • Check scalar types, not just displayed text.
  • Compare array lengths and item order.
  • Keep a redacted sample in the bug report.
Try it free - JSONSmith

Format, minify, and diff JSON or YAML

Open the tool

Frequently asked questions

What is the size limit for JSON tools?

Local tools typically handle payloads up to about 2 MB. Larger responses should be trimmed to the relevant subtree first.

Does it validate JSON syntax?

Yes. Invalid JSON produces a clear error rather than silent failure, so a trailing comma or missing brace is caught immediately.

Can I diff YAML as well as JSON?

Yes. Most JSON tools also pretty-print YAML and accept either format on both sides of a diff.

Why shouldn't I paste payloads into an online formatter?

Because debug payloads often contain tokens and customer data, and online formatters may store what you paste. Local tools keep the payload entirely in your browser.

Why does the diff highlight every line?

The two payloads likely use different indentation or key order. Format both first; JSON object order is not semantically meaningful.

Can I diff YAML as well as JSON?

Yes if the tool parses both. Convert both to JSON or to the same normalized structure before comparing.

Why do numbers change after formatting?

Large integers can lose precision if a tool parses them as floating point. Keep IDs as strings in the payload to avoid that.

Can I diff two JSON files by key instead of line?

A structural diff does that. A line diff is faster for a quick check but can miss reordered keys with the same values.