What is a JSON formatter?
A JSON formatter takes compact or messy JSON and rewrites it with consistent indentation so people can read it. This free JSON formatter and validator also minifies JSON, sorts object keys and checks the syntax, pointing to the exact line and column of any error. Paste your JSON and the result updates instantly. Everything runs in your browser, so API responses and configuration files never leave your device.
How to format and validate JSON online
- 1
Paste or type your JSON into the input box, or press “Try an example”.
- 2
Choose Beautify or Minify, then pick 2 spaces, 4 spaces or tabs for the indentation.
- 3
Turn on “Sort keys” if you want object keys in alphabetical order.
- 4
If the JSON is invalid, read the line and column of the error and fix it; otherwise copy or download the result, or switch to the tree view.
Key features
Exact error positions
Invalid JSON is reported with the line, the column and a pointer to the character that broke the syntax.
Beautify, minify and sort
Switch between readable output with 2 spaces, 4 spaces or tabs and a compact single line, and sort keys alphabetically at every level.
Collapsible tree view
Explore large documents as a tree with colored values and expandable objects and arrays.
Private by design
Parsing happens locally in your browser. Large numbers keep their exact digits instead of being rounded.
Frequently asked questions
How do I format JSON online?
Paste the JSON into the input box and choose Beautify. The formatted result appears immediately with the indentation you selected, ready to copy or download.
How do I find the error in my JSON?
If the JSON is invalid, the tool shows the line and column where parsing failed, together with the offending line and a caret under the character. Common causes are trailing commas, single quotes, unquoted keys and missing brackets.
What is the difference between beautify and minify?
Beautify adds line breaks and indentation to make JSON readable. Minify removes all unnecessary whitespace to produce the smallest possible text, which is useful for network payloads and storage.
Does JSON allow comments or trailing commas?
No. Standard JSON (RFC 8259) does not allow comments, trailing commas, single-quoted strings or unquoted keys. This validator follows the standard strictly.
Is my JSON sent to a server?
No. The JSON is parsed and formatted entirely in your browser. Nothing you paste is uploaded or stored on a server.