JSON Formatter & Validator
Format and validate JSON entirely in your browser. Nothing is uploaded.
What this tool does
Takes any valid JSON string and returns a clean, indented version that's easier to read. It also flags syntax errors with the line and column where parsing failed, so you can find the problem instead of guessing. Everything happens in your browser. Your input never leaves the page, never gets uploaded, never gets logged.
How to use it
Paste your JSON into the input box, pick an indent style (2 spaces is the default), and press Format. If your input is valid, you'll see the cleaned-up version below. If it's invalid, you'll see exactly where the parser stopped and why.
Example: paste {"a":1,"b":[2,3]} and press Format to get
a multi-line indented result.
Common use cases
- Cleaning up an API response copied from a browser network tab.
- Validating a JSON config file before committing it.
- Reformatting minified JSON into something a human can review.
- Spotting a misplaced comma or missing brace in a hand-written object.
Common pitfalls
- Trailing commas. JSON does not allow trailing commas in arrays or
objects.
[1, 2, 3,]is a syntax error even though many languages allow it. - Single quotes. JSON requires double quotes around strings and keys.
{'a': 1}will not parse. Use{"a": 1}instead. - Comments. Standard JSON has no comments. If your input has
//or/* */, it's a different format (JSON5 or JSONC).
Frequently asked questions
- Why does my JSON show a trailing comma error?
- JSON does not allow trailing commas inside arrays or objects, even though most programming languages do. A construct like [1, 2, 3,] is a syntax error. Remove the comma after the last element to make it valid.
- Can JSON have comments?
- Standard JSON does not support comments. If your file has // or /* */ comments, it is in JSON5 or JSONC format, not JSON. Remove the comments before parsing as standard JSON, or use a parser that explicitly supports comments.
- How is JSON different from a JavaScript object literal?
- JSON is a strict subset of JavaScript object literal syntax. JSON requires double quotes around all strings and keys, prohibits trailing commas and comments, and supports only a small set of value types (string, number, boolean, null, array, object). JavaScript object literals are more permissive.
- What does minifying JSON do?
- Minifying removes all insignificant whitespace (spaces, tabs, newlines) without changing the data. The result is a single-line string that takes less storage and less network bandwidth. Use the Minify button on this tool, or call JSON.stringify(obj) without the indent argument in JavaScript.
- Is the JSON I paste here uploaded anywhere?
- No. The tool runs entirely in your browser. Your input is never sent to a server. You can use the tool offline once the page has loaded.
- What does "Unexpected token" mean when parsing fails?
- The parser found a character or symbol that does not fit the JSON grammar. The error message usually includes the line and column where the parse stopped. Common causes: unquoted keys, single quotes instead of double quotes, trailing commas, comments, or a misplaced bracket.
- Can JSON have multi-line strings?
- No. JSON strings are single-line; embedded newlines must be escaped as backslash-n. If you need multi-line literals, look at JSON5, YAML, or TOML instead.
Cite this tool
For academic, journalistic, or technical references. Pick a format:
Citations use 2026 as the publication year. Access date is left as a fillable placeholder where the citation style expects one.