What is a JSON Formatter?

A JSON formatter takes raw JSON text and either beautifies it — adding consistent indentation and line breaks — or minifies it by stripping all unnecessary whitespace. Both operations parse and re-serialize the input via JSON.parse and JSON.stringify, which also validates that your JSON is syntactically correct. Everything runs in your browser — no data is sent to a server.

How to Use

  1. Paste your JSON into the input box.
  2. Click Beautify for readable output with 2-space indentation, or Minify for a compact single-line string.
  3. If the input is invalid, an error message shows the exact parse failure.
  4. Click Copy Output to copy the result to your clipboard.

Common JSON Errors

  • Trailing commas { "a": 1, } is invalid. Remove the comma after the last item in objects and arrays.
  • Single quotes — JSON requires double quotes. { 'key': 'value' } will fail.
  • Unquoted keys { key: "value" } is valid JavaScript but not valid JSON. All keys must be quoted strings.
  • Comments — JSON has no comment syntax. Remove any // or /* */ blocks before formatting.
  • Missing commas — Every element except the last in an object or array must be followed by a comma.

FAQs

What is the difference between beautify and minify?

Beautify adds indentation and newlines so the structure is easy to read. Minify removes all unnecessary whitespace to shrink file size — useful before sending JSON over a network or storing it in a database.

Does formatting change my data?

No. Formatting only changes whitespace. Keys, values, types, and order are preserved exactly. The one exception is duplicate keys in the same object — JSON.parse keeps only the last occurrence.

What is the maximum file size this tool can handle?

There is no hard limit enforced by the tool. Practical limits depend on your browser's available memory. For very large files (tens of MB), consider a local CLI tool like jq instead.