JSON Formatter: Complete Usage Guide

Pretty-print, validate and minify JSON locally — with clear errors instead of cryptic offsets.

Open the tool

Purpose

The JSON Formatter takes a minified or malformed JSON blob and turns it into readable, indented output — or the reverse, stripping every byte of whitespace for transmission. It also validates: if the input is broken, you get the position and reason rather than a bare parser exception. Because it uses the browser's native parser and never sends data anywhere, you can safely paste production API payloads containing customer data or tokens.

How to use it

  1. 1Paste your JSON into the input panel.
  2. 2Choose Prettify to expand it with indentation, or Minify to strip all whitespace.
  3. 3Read the validation message — it names the problem and where it occurred if the JSON is invalid.
  4. 4Copy the formatted output, or paste in a new payload to start over.

Tips & tricks

  • Format anything you plan to read; minify only at the network boundary. Minified files in Git make code review impossible.
  • Two-space indentation is the de-facto standard and keeps deeply nested structures on screen.
  • Transmit large integer IDs as strings. JSON numbers are doubles and silently lose precision above 2^53.
  • Use ISO 8601 for dates — '2026-03-11T09:30:00Z' is unambiguous in a way Unix timestamps are not.
  • Pair with the JWT Decoder and Base64 Encoder when you are debugging API authentication.

Common errors and fixes

Unexpected token error near the end
Almost always a trailing comma. '{"a": 1,}' is valid JavaScript but invalid JSON.
Unexpected token ' in JSON
JSON requires double quotes on keys and string values. Single quotes are not allowed.
Bad escaped character
Backslashes must be doubled inside strings. Windows paths are the usual cause: use 'C:\\Users\\me'.
Comments break the parse
JSON has no comment syntax. Strip // and /* */ lines, or switch the file to JSON5 or YAML.
The whole thing fails on character 0
A byte-order mark. Re-save the file as UTF-8 without BOM.

More guides