JSON Formatter and Validator
Format, validate and explore JSON with precise error reporting.
JSON Formatter
Developer tool running locally in browser
What does JSON Formatter do?
Pretty-print JSON with your choice of indentation, or collapse it to a single line. Syntax errors are reported with the exact line and column, and a collapsible tree view makes deeply nested payloads navigable.
How to Use JSON Formatter
- 1Paste your JSONValid or broken — errors are reported precisely.
- 2Choose the indentationTwo spaces is the most common convention.
- 3Explore or copyUse the tree view to navigate, or copy the formatted text.
Key Features
- Indent with 2 spaces, 4 spaces or tabs
- Collapsible tree view with the JSON path of any node
- Syntax errors reported with line, column and the offending token
- Key sorting for stable diffs
- Statistics: object count, array count, depth and size
- Copy or download the formatted result
Frequently Asked Questions
Why is my JSON invalid?
The usual culprits are a trailing comma after the last item, single quotes instead of double, unquoted keys, and comments — none of which JSON allows. The error message gives the exact position so you can find it fast.
Can JSON have comments?
No. The specification has no comment syntax. JSON5 and JSONC add them and are common in config files, but a strict parser — including this one and most APIs — will reject them.
Is my data sent anywhere?
No. Parsing and formatting use the browser’s built-in JSON engine. Nothing you paste leaves the page.
What indentation should I use?
Two spaces is the most common convention for JSON and is what most formatters default to. Use tabs only if your team’s style guide calls for them; the file size difference is negligible after compression.
Input is processed in your browser and never transmitted. That said, treat any web page as untrusted for live production secrets — rotate anything you paste anywhere.
Related Tools
JSON Validator
Check whether JSON is valid and get the exact error position.
JSON Minifier
Strip whitespace from JSON to make it as small as possible.
JSON to CSV Converter
Turn a JSON array into a spreadsheet-ready CSV.
JSON to YAML Converter
Convert JSON into readable YAML for configuration files.
