How to use the json formatter & validator
- Paste your JSON into the left box.
- Choose Format for indented output, or Minify to remove all whitespace.
- If the JSON is invalid, the error message tells you what the parser found.
- Copy the result with the Copy button.
About this tool
Paste minified or messy JSON and get clean, indented, colour-coded output in one step. Keys, strings, numbers, booleans and null each get their own colour, so API responses and config files are easy to scan. Invalid JSON shows the line and column of the error. Because everything runs locally, it is safe for real payloads, tokens and customer data.
What this JSON formatter does
APIs, log files and config exports often arrive as one long unreadable line. This tool parses the text, checks that it is valid JSON, and prints it back with consistent indentation. Keys, strings, numbers, true/false and null are shown in different colours, so you can see the structure at a glance instead of counting brackets.
It also works the other way. Minify strips every unnecessary space and line break, which is useful when you need a compact payload for a request body, an environment variable or a test fixture.
Before and after
This is the kind of response you might copy from a browser network tab, followed by the formatted result with 2-space indentation:
{"user":{"id":1042,"name":"Asha","roles":["admin","editor"],"active":true,"manager":null}}{
"user": {
"id": 1042,
"name": "Asha",
"roles": [
"admin",
"editor"
],
"active": true,
"manager": null
}
}Why is my JSON invalid? The most common errors
JSON is stricter than JavaScript. If the tool reports an error, the line and column point to where the parser gave up, which is usually just after the real mistake. These are the usual causes:
| Mistake | Example | Fix |
|---|---|---|
| Trailing comma | {"a": 1,} | Remove the last comma |
| Single quotes | {'a': 1} | Use double quotes for keys and strings |
| Unquoted key | {a: 1} | Write "a" in double quotes |
| Comments | // note | JSON has no comments. Delete them |
| Special values | NaN, undefined, Infinity | Use null or a string instead |
| Leading zeros | {"a": 007} | Write 7, or use a string "007" |
Format, validate or minify?
Formatting changes only whitespace, never your data. Validating means checking the syntax, and this tool does it every time you paste, because anything that parses can be formatted. Minify is the reverse of format. Turn on Sort keys A-Z when you want to compare two JSON documents, since both will list their keys in the same order.
One technical note: this tool uses the JSON parser built into your browser. Whole numbers larger than 9,007,199,254,740,991 cannot be stored exactly by JavaScript, so very large IDs may be rounded in the output. If that matters, keep such IDs as strings.
Is it safe to paste real data?
Yes, in the sense that matters here: parsing, colouring and sorting all happen inside your browser tab, and nothing you paste is sent to a server. That makes it suitable for API responses, access tokens in payloads and customer records. You can confirm it by opening your browser network panel while you use the tool.
Frequently asked questions
Is my JSON uploaded anywhere?
No. Everything runs in your browser. Your input is never sent to a server.
Why does my JSON fail to validate?
The most common causes are trailing commas, single quotes instead of double quotes, and unquoted keys. JSON is stricter than JavaScript object syntax.
Does minify change my data?
No. Minify only removes whitespace. Keys and values stay exactly the same.
Can JSON contain comments?
No. Standard JSON has no comment syntax. Files such as tsconfig.json allow comments only because their tools use a more relaxed parser called JSONC.
Does the order of keys matter?
Not to JSON itself. Most programs ignore key order, which is why sorting keys is safe when you only want to compare documents.