JSON Formatter

Paste JSON to pretty-print, minify, or sort its keys. Validation and formatting happen entirely in your browser.

Options

How to format JSON

  1. Paste or type your JSON into the input box. It is validated and formatted as you type.
  2. Pick an indent (2 spaces, 4 spaces, or a tab) to pretty-print, or choose Minify to collapse everything onto one line.
  3. Optionally turn on “Sort keys” to order every object’s keys alphabetically.
  4. Copy the result. If the JSON is invalid, the inline message points to where parsing failed so you can fix it.

When to use it

API responses, config files, and log payloads often arrive as one dense line. Pretty-printing reveals the structure so you can read and debug it; minifying does the reverse, stripping whitespace to shrink a payload before you embed it in code or send it over the wire.

Sorting keys helps before committing a config file or diffing two API responses: with keys in a stable order, a comparison shows only the values that actually changed instead of lines that merely moved.

Frequently asked questions

Is my JSON sent to a server?

No. It’s parsed and re-serialized in your browser with the native JSON engine. Nothing is uploaded.

Can it both pretty-print and minify?

Yes. Pick 2-space, 4-space, or tab indentation to format, or choose minify to strip all whitespace into one line.

What does “sort keys” do?

It orders every object’s keys alphabetically, recursively, for stable, diff-friendly output.

How does it report invalid JSON?

It shows the parser’s error message inline, including where the problem is, so you can jump to the spot.