JSON formatter & validator

Beautify, minify, sort, escape — with errors pinned to line and column.

About & FAQ ↓
JSON input
Waiting for input.
Result

Relaxed mode tolerates trailing commas, single quotes, unquoted keys and comments — handy for pasting config files.

Reference
Formatter & validator

About the JSON formatter

A JSON formatter is the tool you reach for when an API hands you 40KB on one line. This one beautifies it with 2-space, 4-space or tab indentation, minifies it back down when you need it small, sorts keys so two payloads can be compared, and escapes or unescapes JSON that has been embedded inside another string. If the document will not parse, it tells you the line and column and quotes the offending line, instead of the usual "Unexpected token".

01

Beautify or minify

Two-space, four-space or tab indentation, or strip it all out and see how much smaller it got.

02

Errors you can act on

Parse failures name the line and column and quote the offending line, instead of "Unexpected token".

03

Relaxed input

Optionally accept comments, trailing commas, single quotes and unquoted keys — real config files, in other words.

04

Sort, escape, unescape

Order keys for comparison, escape JSON into a string literal, or pull one back out.

How to use it

  1. Paste, drop or upload your JSON on the left.
  2. Pick a mode — beautify, minify, escape or unescape — and an indent width.
  3. Copy the result, or download it as a .json file.

Questions

Is my JSON uploaded to a server?

No. The formatter is JavaScript running in your own tab; the payload never leaves your machine. You can check in DevTools — the network tab stays silent while you work.

Can it handle JSON with comments or trailing commas?

Yes — tick "Accept JSON5-ish input". It tolerates comments, trailing commas, single-quoted strings and unquoted keys, which is what most config files and hand-edited payloads actually look like, and converts them to strict JSON.

How large a file can it format?

Large ones. Since there is no upload step, the limit is your browser's memory rather than a server request size — multi-megabyte payloads format in place.