How to format and validate JSON
- Paste JSON into the left box, open a file or drop one onto it. The formatted result appears on the right as you type.
- If the JSON is not valid, the message names the problem with its line and column; Show the error in the input puts the cursor on it.
- Choose the indent, or tick Minify to put everything on one line. Sort keys orders the keys of every object alphabetically, which makes two versions easier to compare.
- Click Copy or Download .json.
Common JSON errors and how to fix them
| Message | Cause and fix |
|---|---|
| Trailing comma before "}" or "]" | A comma after the last item, as in [1, 2,]. JSON does not allow it; remove the comma, or tick Allow comments and trailing commas to have it removed. |
| Expected a key in double quotes | Keys must be in double quotes: {"name": 1}, not {name: 1} or {'name': 1}. |
| Strings must use double quotes | Single quotes are not JSON. Replace 'text' with "text". |
| Comments are not allowed | Configuration files often contain // or /* */ comments (sometimes called JSONC). Strict JSON has none; the lenient option removes them. |
| Line break inside a string | A string must stay on one line; write a line break as \n. |
| Expected "," or "}" after a value | Usually a missing comma between two items, or a missing closing bracket on the line before. |
| Invalid number | Numbers cannot have leading zeros (007), a leading + or a trailing dot. Put codes such as postcodes in quotes. |
The tool also reports duplicate keys. They are valid JSON, but most programs silently keep only the last value, which is a common source of configuration mistakes.
Big numbers are kept exactly
Many formatters read the JSON into JavaScript numbers and write it back. JavaScript numbers hold about 16 significant digits, so an ID like 12345678901234567890 comes back as 12345678901234567000, and the formatted file quietly contains a different ID. This formatter never converts numbers: every number is written exactly as it appears in the input, and the status line tells you when the input contains numbers that other tools would change. Escapes in strings, such as \u00e4, are kept as written too.
Why it points out secrets
JSON copied from logs, API responses or configuration files often contains passwords, API keys and tokens. Formatting sites that offer "save" or "share" links keep what you paste on their servers; in 2025, security researchers found thousands of such saved snippets on two popular formatting sites, many containing live credentials, readable by anyone who guessed the links. This tool has no server, no save function and no share links. It also lists values under keys such as password, apiKey, token or client_secret, and Mask secrets replaces them with "***" so the result is safe to paste into a ticket or a chat.
Frequently asked questions
- Is my data uploaded?
- No. The formatter runs in your browser. You can check it in the Network tab of your browser's developer tools or use the page offline once it has loaded.
- How large can the JSON be?
- Files of tens of megabytes work; the limit is your device's memory. For very large input the result updates a moment after you stop typing.
- Does it change my data?
- Only the whitespace, plus what you ask for: sorted keys, masked secrets, or removed comments and trailing commas. Keys, strings and numbers are written exactly as they were.
- Can it convert JSON to CSV?
- Yes, with the CSV ⇄ JSON converter.
- What does it cost?
- Nothing. There are no ads, no sign-up and no limits.