JSON Formatter & Validator
Beautify or minify JSON, catch syntax errors with line numbers, and copy the clean result.
How JSON Formatter works
Format, validate and minify JSON with precise error messages. Everything runs locally in your browser. Everything happens inside this page: the tool reads your input, runs the calculation or conversion locally, and hands the result back to you. Nothing is transmitted, because there is no backend to transmit it to.
That design choice is deliberate. Most free tool sites upload your files to a server, process them there, and quietly keep a copy. Toolcin cannot do that — the site is a set of static files. If your connection dropped the moment the page finished loading, every tool would still work.
What formatting does, and what it cannot fix
The tool parses your text with the browser's own JSON parser and prints it back with indentation. That means the output is guaranteed to be valid JSON — if it parses, it re-serialises, and if it does not, you get the parser's error instead of a guess.
Formatting cannot repair broken JSON. A trailing comma, a single-quoted string, an unquoted key or a comment will fail, because none of those are JSON. They are JavaScript object literal syntax, which looks similar enough to cause most of the confusion.
Finding the exact error
When parsing fails, the status line reports the parser's message and converts its character position into a line and column. That is the difference between “unexpected token” and “line 14, column 3”, which is usually enough to see the stray comma.
The output area is cleared to a dash on failure rather than showing partial output. Half-formatted JSON that silently drops the broken section is worse than no output.
Indentation, minifying and size
Two spaces, four spaces and tabs are offered because different codebases disagree. JSON itself ignores whitespace entirely, so the choice is purely for humans reading a diff.
Minify removes all optional whitespace and is what you want before sending a payload over a slow connection or storing it in a size-limited field. The status line reports the key count and the byte size of the result, so you can see immediately what the whitespace was costing.
| Mode | Output | Use it for |
|---|---|---|
| 2 spaces | Readable, compact | Most codebases and diffs |
| 4 spaces | Readable, wider | Older style guides |
| Tab | Readable, editor-controlled | Projects that indent with tabs |
| Minify | No whitespace at all | Payloads, storage, config files |
Large files and duplicate keys
Parsing happens on the main thread, so a 50 MB JSON document will freeze the tab briefly. For files that size, use a command-line tool — it will be faster and will not risk losing an unsaved edit in another tab.
Duplicate keys are legal in the grammar and resolved by keeping the last one. If an API returns the same key twice, the formatter will show only the survivor, which can look like data loss when it is really the parser doing what the specification says.
Good to know
- Works offline once loaded, including on flights and in locked-down networks.
- No file size limit beyond your device's own memory.
- Free to use, with no account and no usage counter.
- Results are produced locally, so they are not logged or shared with anyone.
Questions
Will it tell me where my JSON is broken?
Yes — the validator reports the error message together with the line and column where parsing failed.
Does it handle large files?
It handles files up to a few megabytes comfortably; very large payloads depend on your device memory.
Does it validate JSON Schema?
No. It checks syntax only — the file will parse — not whether the structure matches a schema.
Is my data sent anywhere?
No. Parsing and formatting happen in the page; nothing is transmitted and the tool works offline once loaded.
Keep going
More developer tools
Regex Tester
Test regular expressions live with highlighted matches, capture groups and a replace preview.
Open toolCron Parser
Turn a five-field cron expression into a readable description with the next five scheduled runs in your timezone.
Open toolHTML Formatter
Indent nested HTML so the structure is readable, without changing any markup.
Open toolCSS Minifier
Strip comments and whitespace from CSS and see exactly how many bytes you saved.
Open toolJSON Array to Text
Flatten a JSON array into one value per line. Objects inside the array are written as compact JSON on their own line.
Open toolJSON Minifier
Compress JSON by removing every unnecessary space and newline. Whitespace is insignificant in JSON, so minifying never changes meaning — the size saving is shown.
Open tool