JSON

JSON formatter and pretty printer

Paste minified or messy JSON and get readable, consistently indented output. DocuFormat validates as it formats, so you know right away whether the document is actually valid.

input.jsonDetected: JSON ✓
{"name":"DocuFormat","active":true,"formats":["json","yaml","xml"],"limits":{"maxMb":0.5,"retries":3}}
output.json
{  "name": "DocuFormat",  "active": true,  "formats": [    "json",    "yaml",    "xml"  ],  "limits": {    "maxMb": 0.5,    "retries": 3  }}
✓ Valid JSON · formatted locally

What the JSON formatter does

Formatting turns a single line of compact JSON into an indented structure where every object and array is easy to scan. DocuFormat uses two-space indentation and keeps your key order exactly as written.

Because formatting is done by a real parser rather than a language model, the result is predictable: the same input always gives the same output, and the data itself never changes, only the whitespace around it.

Pretty print, beautify, or minify

“Pretty printing” and “beautifying” are the same operation under two names: add line breaks and indentation. Minifying is the reverse. It strips optional whitespace so the payload is as small as it can be, which is handy for config values, query strings and test fixtures.

Both directions are available from the same input. Format to read it, minify to ship it, then use Swap to move the output back into the input if you want to keep working on it.

Strict JSON, not “JSON-ish”

The formatter follows the JSON specification. It will not quietly accept things that other tools tolerate but real parsers reject:

  • comments (// or /* */)
  • trailing commas after the last item
  • unquoted property names
  • single-quoted strings

When any of these show up, formatting stops and DocuFormat reports the problem with a line and column. That is usually exactly what you need when a service is returning a 400 for your payload. See the JSON validator for how errors are reported, or the JSON fixer for repairing them.

When to use it

  • Reading an API response copied from logs, a terminal or browser dev tools.
  • Cleaning up a config file before a code review.
  • Checking that a hand-edited fixture is still valid.
  • Shrinking a pretty-printed document before embedding it somewhere.

Questions, answered

Is my JSON sent to a server when I format it?

No. Format detection, parsing, validation and formatting run in your browser. Content is only sent to an AI provider if you explicitly click AI Fix or Explain.

What indentation does it use?

Two spaces.

Can it format JSON with comments?

No. Comments are not part of JSON, so the formatter reports them as errors rather than silently dropping them. AI Fix can remove them if you ask.

Does formatting change my data?

No. Only whitespace changes. Key order and values are preserved.

Can it minify JSON?

Yes. Use Minify to remove all optional whitespace.

Try the JSON formatter on your own input.

Paste it, format it, and fix it if it is broken, once DocuFormat opens.