JSON Formatter & Beautifier

Paste JSON to reindent it for reading, compact it to one line, or remove trailing commas with one click. Copy or download the result. Everything runs in your browser and your input stays on this device.

JSON workspace JSON
Ready when you are. JSON is processed locally.
INPUT
230 chars · 11 lines
OUTPUT

Your formatted JSON appears here

Paste or edit JSON in the input editor, then choose Format JSON or Minify.

What this tool does

Reindent parsed JSON for reading, compact it for transport, or remove trailing commas with Correct JSON.

Formatter, beautifier and pretty print: what’s the difference?

For JSON, these terms mean the same thing: reindenting parsed data so people can read it. Minify does the opposite and removes the whitespace. Formatting is meant to change only whitespace, but because the text is parsed first, integers beyond JavaScript’s safe range can lose digits, so keep long identifiers as strings.

When to use it

A readable inventory response makes it easier to spot which records are missing fields. A compact version fits into fixtures or a one-line log entry.

How to use it

  1. Paste one JSON document into Input or load the sample.
  2. Choose Format JSON for indentation, Minify for compact output, or Correct JSON when trailing commas are the issue.
  3. Review the status and output before copying or downloading.

To see what changed between two versions, use the JSON diff tool.

Worked example

Paste {"team":"platform","checks":[{"name":"build","passed":true},{"name":"lint","passed":false}]} and choose Format. The two check objects appear on separate indented lines, so you can scan the names and compare their passed values without counting braces. Choose Minify to put the payload back on one line for a fixture that expects compact JSON. If someone adds a comma after the final check object, try Correct JSON, then inspect the result before replacing the fixture. Keep the original nearby when debugging a parser error in a shared file so you can confirm the exact edit.

Example input
{"id":"sku-42","stock":[3,8]}
Example output
{
  "id": "sku-42",
  "stock": [
    3,
    8
  ]
}

Supported features and limitations

Accepts a single standard JSON value. Correct JSON handles trailing commas. Check payload-specific requirements with the receiving schema.

Common mistakes and edge cases

JSON requires double quotes around property names and strings. Single-quoted strings, comments and unquoted keys are common when copying a JavaScript object literal. Correct JSON handles trailing commas and leaves other syntax errors for you to fix. A comma inside a quoted message is part of the value and should stay there. Duplicate keys deserve special attention because parsing can keep only the last value. Keep unusually large identifiers in strings when exact digits are important. For a regression test, format a fixture containing a string such as a,b and compare the parsed values before and after formatting. That check catches accidental changes to values while allowing line breaks and indentation to change.

Frequently asked questions

Can I format an array or a single value?
Yes. Arrays and standalone JSON values such as true or null are valid. A file containing several independent JSON values on separate lines needs to be split into individual inputs first.
When should I use the JSON Validator?
Use it when you want to check whether the original text parses. Keep the formatter for changing whitespace or correcting trailing commas. When an API rejects valid JSON, compare the field names and types with the endpoint’s schema before changing the indentation.
How do I fix a trailing comma in JSON?
A trailing comma after the last item in an object or array makes the JSON invalid. Choose Correct JSON to remove it, then check the output before replacing your file.
Does Correct JSON fix single quotes or comments?
No. It handles trailing commas only. JSON requires double quotes around keys and strings and doesn’t allow comments, so those errors need to be fixed by hand.
What is the difference between formatting and minifying JSON?
Formatting adds indentation and line breaks so it’s easy to read. Minifying removes them to make the text compact. The data is the same either way.
Is my JSON uploaded anywhere?
No. The text is processed in your browser and stays on your device.

Related tools

Developer guides