Skip to content

JSON Formatter, Validator & Minifier

Pretty-print, minify or validate JSON with line and column error reporting plus key and depth stats.

JSON Formatter, Validator & Minifier Runs in your browser

Nothing is sent to a server — validation happens in your browser.

What a JSON formatter is for

JSON is the language of modern APIs, but by design it is compact: one long line with no spacing. Reading or editing that line by hand is nearly impossible, and a single missing comma or bracket makes the whole document invalid. A formatter restores readable indentation and pinpoints the exact location of an error.

The tool runs in your browser and never sends your code anywhere. That matters when you are inspecting API responses that contain access tokens or customer data that should not leave your machine.

How to use it

  1. Paste the JSON into the first box.
  2. Press “Format” to indent it with 2 or 4 spaces, matching your team’s style.
  3. Press “Minify” for a compact version that reduces transfer size.
  4. Press “Validate” to confirm the payload is sound before sending a request.
  5. On an error, read the reported line and column, fix that spot, and validate again.

Common JSON mistakes

  • A trailing comma after the last item. JavaScript allows it; JSON does not.
  • Single quotes instead of double quotes.
  • Comments inside the file, which the original specification does not permit.
  • Numbers wrapped in quotes when they should be numeric.
  • Duplicate keys in one object. The last value wins, which is very hard to spot by eye.

What the stats mean

The key count tells you the overall size of the object, and depth shows how many levels are nested, a useful signal of complexity. A depth of ten levels usually means the structure needs redesigning. The byte size helps you judge transport cost before caching or forwarding a response.

Frequently asked questions

Does formatting preserve key order?

Yes. Formatting parses and re-serialises the document without reordering keys, so the original order is kept.

Does it handle large files?

It is comfortable with typical responses up to a few hundred kilobytes. Very large documents can slow the browser, and a command-line tool is a better fit there.

Why is the line missing from some errors?

Browsers phrase errors differently. When a position is available we compute line and column; otherwise we show the original message. If the message is vague, paste the payload into a smaller file and bisect it: remove half the keys, validate, and repeat until the broken branch is isolated.

Does JSON allow comments?

No. The original specification forbids comments, even though some configuration formats permit them. Strip comments before validating, or use a variant such as JSONC when the tool reading the file supports it.

Share this article X Facebook WhatsApp