JSON Formatter
Free online JSON formatter and validator. Paste raw JSON to beautify, minify, validate, and explore with a collapsible tree view. Instant results. No signup.
How to Use the JSON Formatter
Paste your JSON into the left panel. The tool validates it instantly — a green banner confirms valid JSON, a red banner pinpoints exactly where any error is. Switch between the three output tabs: Formatted shows your JSON pretty-printed with syntax highlighting, Minified strips all whitespace for compact output, and Tree lets you explore nested structures by expanding and collapsing nodes. Use Copy or Download to save the result.
About This Tool
Format, validate, minify, and explore JSON data entirely in your browser. Paste raw JSON from API responses, config files, or databases and instantly see it pretty-printed with syntax highlighting, compacted for transmission, or rendered as an interactive tree. The validator pinpoints the exact line and character of any error with plain-English explanations. Supports JSONC (JSON with comments), detects common JavaScript-object mistakes like unquoted keys and trailing commas, and handles inputs up to hundreds of kilobytes. Zero external libraries — everything uses native JSON.parse() and JSON.stringify().
Quick Reference Table
| JSON Type | Example |
|---|---|
| String | "hello" |
| Number | 42, 3.14, -1 |
| Boolean | true, false |
| Null | null |
| Object | { "key": "value" } |
| Array | [1, 2, 3] |
Frequently Asked Questions
Why does my JSON have comments but show as invalid?
Standard JSON does not support comments. Formats like JSONC (used in VS Code settings and tsconfig.json) extend JSON with comment support. This tool automatically strips comments before parsing and notes when it has done so.
What is the difference between JSON and a JavaScript object?
JSON is a text format — it is always a string. A JavaScript object is a data structure in memory. JSON requires double-quoted keys and strings, does not allow trailing commas, and does not support undefined, functions, or Symbol values.
Is my JSON data sent to a server?
No. All formatting, validation, and tree rendering happens entirely in your browser using native JavaScript. Your JSON never leaves your device.
Can this handle very large JSON files?
Yes. Formatted and Minified output work on arbitrarily large inputs. The Tree view caps at 10,000 rendered nodes for performance and renders children lazily on expand.
What indent size should I use?
2 spaces is the most common convention for JSON files in web projects and npm packages. 4 spaces is common in other ecosystems. Tab indentation is preferred in some style guides and uses less file size than spaces.