What is a JSON formatter?
JSON is the most common format for exchanging data between front and back end, but machine-generated JSON is often crammed into one unreadable line. This online JSON formatter instantly beautifies messy JSON into a clear indented structure — or minifies it to the smallest size — while validating the syntax and pinpointing errors.
How to use
- Paste your JSON into the input box on the left.
- Choose the indentation (2 spaces, 4 spaces or Tab).
- Click Beautify to make it readable, or Minify to collapse it to one line.
- The result appears on the right and can be copied in one click. If the JSON is invalid, the status bar explains why.
Common use cases
- Inspect the structure of an API response.
- Normalize config files to a consistent indentation style.
- Minify JSON before shipping to reduce payload size.
- Validate hand-written JSON before your code parses it.
Why does my pasted JSON keep failing validation?
You copy a long, minified response straight out of your browser's network tab or an API client, and it's one unreadable line. Paste it here and it's instantly indented, so a mismatched bracket or a truncated payload jumps out and the error points you to the offending line. Keep in mind this tool only formats and validates syntax — it won't fix your data or fill in missing fields. And most 'invalid JSON' isn't a bug in the parser: JSON forbids trailing commas, single quotes, and comments. Objects pasted from JavaScript or Python often include exactly those, which looks right but never parses. Strip them out and it usually validates.
How should you read the position in the error message?
Read the position, not the prose. This page returns, for several kinds of almost-JSON: a trailing comma → ✗ JSON syntax error: Expected double-quoted property name in JSON at position 7 (line 1 column 8) [L1:8]; single quotes → ✗ JSON syntax error: Expected property name or '}' in JSON at position 1 (line 1 column 2) [L1:2]; a missing closing brace → ✗ JSON syntax error: Expected ',' or '}' after property value in JSON at position 12 (line 1 column 13) [L1:13]. Note the last one: position 12 is the end of the input, because the parser only knows something is missing once it runs out of characters — the mistake is at the opening brace on the left, the report is at the far right. When the reported column is the last character of the file, look for an unclosed bracket instead of reading the line it points at.