JSON Formatter, Minifier & Validator
Format, minify, validate and browse JSON - free, no upload.
What this tool does
Paste your JSON, then switch between Format, Minify and Tree view - invalid JSON shows the exact parser error instead of a blank result.
Formats JSON with clean 2-space indentation, or minifies it to the smallest valid representation.
Validates JSON as you type and shows the parser's own error message when it's invalid.
Renders valid JSON as a readable tree view, with keys, strings, numbers and booleans visually distinguished.
Counts every key and array item in the document and reports its maximum nesting depth alongside the result.
Reports input character size so you can gauge how large a pasted document is before working with it.
How to use it
- Paste your JSON into the input box.
- Choose Format, Minify or Tree view.
- Copy or download the result.
Why use this formatter
JSON from APIs and logs arrives minified and hard to read, and a single missing comma breaks everything. Formatting and validating in one place shows the structure and the error.
Why we built it
We built the JSON formatter to combine beautify, minify, validate and tree view in one tool, since they are all the same parse shown different ways. Generate types with JSON to TypeScript and convert with the JSON to CSV converter.
Handy alongside this: the YAML Formatter and the JSON to YAML Converter.
Who this tool is for
- Developers reading API responses
- Analysts checking a JSON export
- Students learning JSON
When to use it
- Reading API responses.
- Finding syntax errors.
- Minifying for transport.
- Browsing a nested structure.
Why formatting, minifying and validating are one tool
All three are the same underlying step - parsing the JSON - just presented differently.
Formatting, minifying, validating and tree-browsing JSON all start with the exact same step: parsing the text with a JSON parser. Once that succeeds, beautifying it, compacting it, or rendering it as a tree are just different views of the same parsed value - and if parsing fails, that failure is the validation result. Splitting these into four separate tools would mean four copies of the same parsing logic for no real benefit.
Why whitespace doesn't change the data, but a formatter still catches real mistakes
Indentation is purely cosmetic in JSON's data model, yet reformatting a document only succeeds if it's actually valid.
The spaces and line breaks between JSON tokens carry no meaning of their own - {"a":1,"b":2} and the same object spread across five indented lines parse to the identical value, which is why formatting or minifying never changes what a program reading that JSON receives. But producing that reformatted output at all requires the parser to accept the whole document first, so running dense or minified JSON through a formatter doubles as a real correctness check: a trailing comma after the last item, a missing closing brace or bracket, an unquoted key, or a stray comment (which JSON's specification doesn't allow) all fail to parse and are reported with the exact error - the kind of mistake that hides easily in a long minified line but that a real parser can't get past.
What you give it, and what you get back
| Item | Details |
|---|---|
| Input | JSON text. |
| Mode | Format, minify or tree view. |
| Output | Formatted JSON or the parser's error message. |
Issues you may run into
| What you see | Why it happens | What to do |
|---|---|---|
| Error with a line number | Trailing comma, single quotes or comments. | Remove them; JSON does not allow them. |
| Page is slow | Very large files render as DOM nodes. | Use the text view for large files. |
| Duplicate keys disappear | The last one wins. | Fix the source. |
Assumptions and limitations
- Very large JSON documents (many megabytes) may be slow to render as a tree, since every node is rendered as real DOM elements.
- JSON with duplicate object keys keeps only the last occurrence, matching how JSON.parse itself behaves.
- Comments are not supported, since they aren't part of the JSON specification.
Frequently asked questions
How do I format JSON online for free?
Paste your JSON and choose Format - it's beautified with 2-space indentation instantly.
How do I minify JSON?
Paste your JSON and choose Minify to get the smallest valid representation with no extra whitespace.
How do I validate JSON and see what's wrong with it?
Invalid JSON shows the parser's own error message, including roughly where the problem is.
What is the tree view for?
It renders valid JSON as an indented, colour-coded tree so you can scan the structure without reading raw brackets.
Is my JSON uploaded anywhere?
No. Everything happens in your browser - nothing is sent to a server.
Does formatting or minifying change my actual data?
No - whitespace between tokens isn't part of the data itself, so formatting and minifying only change how it looks, never the values, keys or structure.
What kind of JSON mistakes will this catch?
Anything that fails JSON.parse - a trailing comma, a missing brace or bracket, an unquoted key, or a comment, since comments aren't valid in JSON - shown with the parser's exact error message.