JSON Formatter
Beautify, minify, and validate JSON. View as a collapsible tree. Errors shown with context. Everything runs in your browser.
Why format JSON?
Raw JSON from APIs or logs is often minified (all on one line) to save bandwidth. Formatting adds indentation and line breaks to make it human-readable. Validating confirms the JSON is syntactically correct before you use it in code.
Tree view colour guide
Object property names are shown in green to distinguish them from values.
String values are shown in rose/red, matching standard syntax highlighting conventions.
Numbers in blue, booleans and null in orange-brown for quick visual parsing.
Frequently asked questions
What is valid JSON?
Valid JSON must have keys in double quotes, strings in double quotes (not single), no trailing commas, and no comments. Numbers, booleans (true/false), null, objects {}, and arrays [] are valid value types.
How do I find the line number of a JSON error?
When JSON.parse() throws a SyntaxError, modern browsers include the position in the error message. This tool shows the error text — look for "position N" which is the character offset from the start.
Is my JSON data safe to paste here?
Yes. This tool runs entirely in your browser using JavaScript. Your JSON is never sent to any server. You can verify this by using the browser's network tab — no requests are made when you click Format.
Can I format JSON with comments (JSONC)?
Standard JSON does not allow comments. JSONC (JSON with Comments) is used by VS Code config files. This tool validates strict JSON — paste after removing comments.
What is the difference between JSON and JavaScript objects?
JSON keys must be double-quoted strings. JavaScript objects allow unquoted keys and single quotes. JSON does not allow functions, undefined, or Date objects as values. JSON.parse() rejects JavaScript-only syntax.