JSON Formatter & Validator
Paste JSON or open a file to pretty-print it, minify it, or browse it as a collapsible tree. Invalid JSON shows the line and column of the problem with a hint. Nothing is sent to a server.
How to use the JSON formatter
- Paste JSON into the box, or open a .json file.
- Choose 2 spaces, 4 spaces, tabs or Minify. Tick Sort keys to alphabetize object keys at every level.
- Switch between Formatted text and Tree view (click any object or array to expand or collapse it).
- Copy or Download the result.
The tool validates as you type: valid JSON shows counts of objects, arrays, keys and nesting depth; invalid JSON shows where the error is.
Common JSON errors
| Error | Example | Fix |
|---|---|---|
| Single quotes | {'name': 'Ana'} |
Use double quotes: {"name": "Ana"} |
| Trailing comma | [1, 2, 3,] |
Remove the last comma |
| Unquoted keys | {name: "Ana"} |
Quote keys: {"name": "Ana"} |
| Comments | // note |
JSON doesn't allow comments; remove them |
| Missing comma | {"a": 1 "b": 2} |
Add a comma between items |
| Special values | NaN, undefined |
Use null or a number or string |
| Unescaped quotes in strings | "He said "hi"" |
Escape: "He said \"hi\"" |
JSON data types
| Type | Example |
|---|---|
| String | "hello" |
| Number | 42, 3.14, -1e6 |
| Boolean | true, false |
| Null | null |
| Object | {"key": "value"} |
| Array | [1, "two", true] |
Format vs. minify
Formatted JSON is easy to read and review. Minified JSON removes all spaces and line breaks, which makes API payloads and config files smaller. Both contain exactly the same data.
Privacy
API responses and config files often contain tokens, keys or personal data. This formatter runs entirely in your browser, so the JSON you paste never leaves your device.
Frequently asked questions
How do I find the error in my JSON?
Paste it here. If it's invalid, you'll see the line and column, a snippet with a marker under the problem, and a hint for common mistakes like trailing commas or single quotes.
Can I view large JSON files?
Yes. Open the file or paste it; tree view collapses deeper levels so big documents stay manageable. Very large files (tens of megabytes) depend on your device's memory.
Does sorting keys change my data?
No. Object key order has no meaning in JSON, so sorting only changes how it's displayed. Array order is never changed.
Is my JSON uploaded anywhere?
No. Parsing and formatting happen in your browser.