Tools
Log in
English

All converters

JSON formatter and validator

Pretty-print, minify and check JSON. Errors show the line, column and reason.

Settings

A JSON formatter adds line breaks and indents so nested data is easy to read, and a validator tells you where the text stops being valid JSON. Paste it or drop a file up to 10 MB, then indent with 2 or 4 spaces or tabs, squeeze it onto one line, sort the keys or browse it as a tree.

How to do it by hand

  1. Paste JSON into the box or drop a .json file onto it.
  2. Pick the indent: 2 spaces, 4 spaces or a tab.
  3. If the text is invalid, go to the line and column in the message and fix that spot first.
  4. For common slips a corrected version is offered; take it and format again.
  5. Copy the result or download it as a file.

Worked examples

{"a":1,}

a comma right before } is not allowed

{"a":1}

{'name': 'Kim'}

single quotes are not JSON, so they become double quotes

{"name": "Kim"}

{ "ok" : true }

minify removes the spaces outside strings

{"ok":true}

Common mistakes

  • Leaving a comma after the last item. JavaScript accepts it, JSON does not.
  • Wrapping keys in single quotes or leaving them bare. JSON keys always need double quotes.
  • Adding // comments. JSON has no comment syntax at all.

Escapes inside JSON strings

WriteMeaning
\"double quote
\\backslash
\/slash (plain / also works)
\bbackspace
\fform feed
\nnew line
\rcarriage return
\ttab
\u00E9a character by code (é)

Questions people ask

How large a file can I check?

Up to 10 MB. Big files are handled in a background worker so the page keeps responding.

What does sort keys do?

It puts the keys of every object in order, at every level, which makes two files easier to compare.

Can I copy the path to a value?

Yes. In the tree view each value has a path such as $.items[0].name that you can copy.