JSON Formatter
Format, validate, and explore JSON with a collapsible tree view. · Updated
A JSON formatter is one of the highest-traffic developer utilities on the web because APIs, configs, and logs ship minified payloads by default. This page focuses on fast local formatting with precise parse errors — line and column when available — plus a collapsible tree for exploring nested structures without uploading anything. Use Sort keys when you need stable diffs, and pair this tool with the JSON Validator or JSON Schema cheat sheet when you need structural guarantees beyond syntax.
Common errors and fixes
Remove a trailing comma before the closing brace, or add the missing property that should come before it.
Why it happens, with a live exampleYour payload is truncated — check for an unclosed string, array, or object.
Why it happens, with a live exampleUnexpected non-whitespace character after JSON
Paste a single JSON value. Extra text after the root object/array is invalid.
Why it happens, with a live exampleExpected property name or '}' in JSON
Object keys must be double-quoted strings. Single quotes are not valid JSON.
Why it happens, with a live exampleOptions
| Option | Description |
|---|---|
| Indent | Controls how many spaces (or a tab) are used for each nesting level. |
| Sort keys alphabetically | Reorders object keys A-Z. Useful for diffing two JSON payloads. |
FAQ
Why do I get 'Unexpected token' errors?
This usually means a trailing comma, a missing quote around a key, or a missing comma between properties. Check the line and column shown in the error.
Can I format very large JSON files?
Files under 5MB format directly in the editor. Larger files are processed in a background worker and offered as a download so the page never freezes.
Does this tool validate JSON Schema?
No, this validates that your JSON is syntactically correct. For schema validation, check our JSON Schema cheat sheet for the vocabulary reference.
Can I sort my JSON keys alphabetically?
Yes, enable 'Sort keys alphabetically' in the options panel before formatting.