JSON Formatter
Paste messy JSON and get it back clean, indented and readable — or find out exactly where it breaks. This free JSON formatter pretty-prints with 2-space, 4-space or tab indentation, minifies to a single line, and validates your JSON with the precise line and column of any error. Free, with no sign-up.
About This JSON Formatter
JSON is the language APIs speak — and it usually arrives as one long, unreadable line. A response like {"name":"Ali","age":26,"skills":["SEO","Writing"]} contains everything you need, but finding one value in a thousand-character line is painful, and spotting the one missing comma that breaks it is worse. This free JSON formatter fixes both problems: paste the JSON, click Format JSON, and it comes back indented and readable. Click Minify and it goes back to a single compact line. And when the JSON is broken, the validator tells you the exact line and column of the error in plain English.
Everything runs in your browser, with no sign-up and nothing uploaded — so it is safe to paste API responses, configuration files and test data. Unicode text such as Urdu or emoji stays readable in the output instead of being hidden behind escape codes.
How to Use It
- Paste your JSON into the input box (or click Load Sample to try an example).
- Choose an indentation: 2 spaces, 4 spaces or tabs.
- Click Format JSON to pretty-print it, Minify to compress it to one line, or Validate Only to check it without changing it.
- If there is an error, read the line and column shown, fix that spot in the input, and format again.
- Click Copy Output to copy the result.
JSON Formatting Examples
This compact input:
{"name":"Ali","age":26,"skills":["SEO","Writing"],"meta":{"free":true,"visitors":128}}
formats with 2-space indentation to:
| Formatted JSON |
|---|
{ |
The status line under the output also summarises what you pasted — for this example: an Object with 6 keys and a nesting depth of 3. Minifying the formatted version returns the original single line exactly, because formatting never changes the data, only the whitespace around it.
Common JSON Errors (and How the Validator Finds Them)
- Trailing comma.
{"a": 1,}looks harmless but is invalid — a comma must be followed by another item. The validator points at the closing bracket after the stray comma. - Single quotes. JSON strings must use double quotes:
{'a': 1}fails at the first single quote. - Missing colon or comma.
{"a" 1}fails where the colon should be;[1 2]fails where the comma should be. - Unclosed brackets.
[1, 2reports that the array is not closed, so you know a]is missing rather than guessing. - Bad literals. JSON allows only
true,falseandnull—tru,Trueandundefinedare all rejected, with the position of the bad value. - Leading zeros.
01is not a valid JSON number; write1or0.1instead.
When to Format and When to Minify
Format JSON whenever a human has to read it: debugging an API response, reviewing a configuration file, documenting an example in a tutorial, or checking test data before you use it. Minify JSON whenever a machine has to carry it: sending it in a request, storing it in a database field, or embedding it in a page — every removed space is a byte saved, and on large payloads that adds up. The two forms are interchangeable, so you can format to inspect, fix, and then minify to ship.
Who Is This Tool For?
- Developers — pretty-print API responses, validate payloads before sending them, and minify JSON for production.
- Students — learn the JSON grammar by breaking it and reading exactly where and why it failed.
- QA and support teams — check the JSON in logs, tickets and error reports without installing anything.
- Content and data teams — tidy JSON exports and configuration snippets before sharing them.
Frequently Asked Questions
Paste your JSON into the input box, choose an indentation (2 spaces, 4 spaces or tabs), and click Format JSON. The cleaned-up, indented version appears in the output box — click Copy Output to take it with you. If the JSON has a syntax error, the tool tells you the exact line and column instead of formatting it.
The validator checks your text against the JSON grammar and reports the first place where it stops being valid JSON — for example, a trailing comma, a missing colon, single quotes instead of double quotes, or an unclosed bracket. You get the line number, the column number and a plain-English description of what was expected, so you can jump straight to the problem.
Formatting (pretty-printing) adds line breaks and indentation so humans can read the structure — the data itself does not change. Minifying does the opposite: it removes every unnecessary space and line break so the JSON is as small as possible, which is what you want when sending it over a network or storing it in a file. Both versions mean exactly the same thing to a computer.
JSON is stricter than JavaScript: a comma must always be followed by another item. Writing {"a": 1,} leaves a comma with nothing after it, which is invalid JSON even though some JavaScript engines accept it in objects. Remove the final comma and the JSON becomes valid. This validator points at the closing bracket right after the stray comma so you can find it fast.
Yes. Unicode text inside JSON strings is kept readable in the output — Urdu, Arabic, Chinese and emoji stay as they are instead of being turned into \u escape codes. Escaped sequences like \u00e9 in your input are also accepted and validated correctly.
No. Formatting, minifying and validation all happen locally in your browser and nothing is uploaded, stored or logged — so it is safe to use with API responses and configuration data.