JSON formatter and validator
Pretty-print, minify and validate JSON, with the exact position of any error.
How it works
Formats JSON with indentation, minifies it back down, and validates it. When parsing fails, the error message and the position in the input are both reported, which is usually enough to find the problem immediately.
The errors that account for most failures are all things JSON forbids and JavaScript allows: trailing commas after the last element, single quotes instead of double, unquoted keys, and comments. JSON has none of these. A file that works when pasted into JavaScript can still be invalid JSON.
Everything runs in your browser, so it is safe to paste a payload containing keys or personal data.
This tool runs entirely in your browser. Nothing you enter is sent to a server, logged or stored, and the page keeps working with the network disconnected.
Common questions
- Why is my JSON invalid when it looks fine?
- Usually a trailing comma, single quotes instead of double quotes, unquoted keys, or a comment. JSON permits none of those, though JavaScript does.
- Are comments allowed in JSON?
- No. The specification has no comment syntax. Formats like JSON5 and JSONC add them, but standard parsers reject them.
Related pages
- Word and character counter Words, characters, sentences, paragraphs and reading time, counted as you type.
- Typing speed test Measure words per minute and accuracy on a one, two or five minute test.
- Remove duplicate lines Strip repeated lines from a list, keeping the first occurrence of each.
- Sort lines alphabetically Sort a list of lines A–Z, Z–A, by length, or numerically.
- Text compare Compare two blocks of text and see which lines were added, removed or changed.
- Regex tester Test a regular expression against sample text, with matches and capture groups shown.
- Case converter Convert text between upper, lower, title, sentence, camel, snake, kebab and other cases.
- Remove empty lines Delete blank lines from a block of text, optionally collapsing runs to one.
- Find and replace Replace every occurrence of a string in pasted text, with optional regex.
- Readability checker Flesch Reading Ease and grade level, with sentence length and passive voice flagged.