JSON Formatter

Pretty-print or minify JSON and see errors with line and column numbers.

Loading tool…

What the JSON Formatter does

Paste JSON and the formatter re-indents it with 2 spaces, 4 spaces or tabs, or compresses it onto one line. Optionally sort object keys alphabetically to make files easier to compare.

If the JSON is invalid you see the problem and its line and column instead of a result, so you can fix it quickly.

How to use it

  1. Paste JSON into the input box.
  2. Choose indentation and whether to sort keys.
  3. Click Format or Minify, then copy or download the result.

Practical examples

  • Make an API response readable.
  • Minify a config before embedding it in a URL or script.

Features

  • 2/4 space and tab indentation
  • Key sorting
  • Minify
  • Structure summary: type, keys, depth

Limitations

  • Follows strict JSON: comments, trailing commas and single quotes are errors.
  • Numbers outside JavaScript’s safe integer range lose precision when parsed (for example very large IDs).
  • Very large documents (tens of MB) may be slow.

Privacy

This tool runs entirely in your browser. What you type is not sent to our servers and is discarded when you close or reload the page.

Frequently asked questions

Is my JSON sent anywhere?

No. It is parsed in your browser.

Why did formatting change my big numbers?

JavaScript stores numbers as 64-bit floating point. Integers above 9,007,199,254,740,991 cannot be represented exactly.