Quick answer: A JSON formatter checks that text is valid JSON and then pretty-prints it with indentation, or minifies it by removing whitespace. Valid JSON uses double quotes around every key and string, and allows no comments, no trailing commas and no single quotes. This tool runs in your browser, so your data is never uploaded.
JSON is the standard format for sending data between web services, apps and configuration files. Raw JSON from an API is often a single unreadable line, and one misplaced comma can break a whole file. This tool makes it readable, checks it, and points to the problem when something is wrong.
Your data is processed in your browser. Nothing is uploaded, which matters when the JSON contains API keys, customer records or other private information.
What each button does
- Format re-indents the JSON with two spaces, four spaces or tabs, so its structure is easy to read.
- Minify removes all unnecessary spaces and line breaks to make the smallest possible version, useful for sending over a network.
- Validate checks the syntax and reports whether it is valid, without changing anything.
- Sort keys orders object keys alphabetically, which helps when comparing two JSON files.
The most common JSON mistakes
- A trailing comma after the last item, such as
{"a": 1,} - Single quotes instead of double quotes around keys and text
- Keys without quotes, such as
{name: "x"} - Comments, which standard JSON does not allow
- Missing commas between items, or unclosed brackets and braces
A worked example
Example. The text {'name': 'Ali',} is invalid for two reasons: it uses single quotes and has a trailing comma. Change it to {"name": "Ali"} and it validates.
Common JSON errors and how to fix them
| Problem | Invalid example | Fix |
|---|---|---|
| Trailing comma | {"a": 1,} | {"a": 1} |
| Single quotes | {'a': 'x'} | {"a": "x"} |
| Unquoted key | {a: 1} | {"a": 1} |
| Comment | {"a": 1 // note} | Remove the comment |
| Missing comma | {"a": 1 "b": 2} | {"a": 1, "b": 2} |
| Special value | {"a": NaN} | Use null or a string |
| Leading zero | {"a": 007} | {"a": 7} |
These are the errors that most often stop a JSON file from parsing, and the standard (RFC 8259) forbids all of them.
Common mistakes to avoid
- Leaving a comma after the last item. This is allowed in JavaScript but not in JSON, and it is the most common reason a file fails to parse.
- Using single quotes or unquoted keys. JSON requires double quotes around both keys and text values.
- Pasting secrets into an online formatter that uploads data. Use a tool that works locally, as this one does, for tokens, keys and personal data.
Frequently asked questions
Is my JSON uploaded to a server?
No. Parsing and formatting run in your browser using built-in JavaScript. Nothing is sent or stored, so it is safe for private data.
Does sorting keys change the meaning of my JSON?
By definition, order does not matter in a JSON object, so meaning stays the same. A few systems do depend on key order, so check before sorting data that feeds one of them.
Is there a size limit?
There is no fixed limit, but very large files, tens of megabytes, may make your browser slow because everything is processed on your device.
What is the difference between JSON and a JavaScript object?
JSON is a text format with stricter rules: keys must be in double quotes, and it cannot hold functions, comments or undefined values. A JavaScript object is more flexible.
People also search for this as: JSON validator, JSON beautifier, JSON pretty print, JSON minifier, format JSON online, fix invalid JSON.
Sources and further reading
Formulas on this page are checked by automated tests against independent references. See how we test our tools.