JSON formatter and validator

Paste JSON to make it readable, squeeze it onto one line, or find exactly where it’s broken. This JSON formatter also fixes common mistakes, such as trailing commas and single quotes.

  • Free
  • No sign-up
  • Runs in your browser
  • Files up to 5 MB

Paste JSON or open a file to see it formatted here.

How to use it

  1. 1Paste your JSON into the box, or open a .json file.
  2. 2Pick Formatted or Minified, an indent, and Key order A–Z if you want sorted keys.
  3. 3Copy JSON or download it. If the box shows an error, Show me selects the spot.

How the formatter reads your JSON

A JSON formatter, also called a JSON beautifier, puts each property on its own line and indents what’s nested. Minifying removes the spaces and line breaks outside strings. Neither changes the data; sorting only changes the key order.

As you type, this JSON checker tests your JSON against the standard, RFC 8259. When something’s wrong, it gives the line and column and names the mistake in plain words: a comma after the last item, single quotes, a property name without quotes, a comment, or a bracket that’s never closed (with where it was opened).

Numbers and text come out exactly as you wrote them. JavaScript’s own JSON reader rounds numbers longer than about 16 digits, so an ID like 12345678901234567890 turns into 12345678901234567000, and it keeps only the last of two properties with the same name. This page formats the text itself, and a note under the result tells you when your JSON has either problem.

Questions

Related tools