JSON Formatter & Validator
Format, minify and validate JSON in one click.
JSON is the lingua franca of APIs — but a missing comma or quote breaks everything.
How to use
- Paste your JSON into the box.
- Click Format for readable output or Minify for compact output.
- Errors are explained in plain language.
About this tool
This formatter pretty-prints nested data, minifies payloads for production, and pinpoints syntax errors.
Your data never leaves your browser — safe for API keys and private payloads.
How it works
JSON (JavaScript Object Notation, RFC 8259) has only six value types: objects ({"key": value}), arrays ([1, 2]), strings (always double-quoted), numbers, true/false, and null. There are no comments, no trailing commas, and no single-quoted strings — those three account for most validation failures.
Formatting (pretty-printing) adds indentation and line breaks without changing meaning; minifying strips all unnecessary whitespace to shrink payloads. {"a":1} and its four-space-indented version are identical to every parser.
Validating before you send catches syntax errors locally. A missing comma surfaces here as a clear message instead of a cryptic 400 response from the server.
Worked examples
Debugging an API call: Paste the body you are about to POST. If the validator reports an unexpected token near position 42, you know exactly where the missing comma is instead of guessing from the server's error.
Reading a minified response: APIs usually return one long line. Paste {"users":[{"id":1,"name":"Ada"}]} and format it to browse the structure comfortably.
Quick reference
| Error message | Usual cause | Fix |
|---|---|---|
| Unexpected token \u0027 | Single-quoted strings | Use double quotes |
| Unexpected token } | Trailing comma like {"a": 1,} | Remove the last comma |
| Unexpected token n | Unquoted key like {name: "x"} | Quote every key |
| Unexpected token / | // comments in the text | JSON has no comments — delete them |
Frequently asked questions
What makes JSON invalid?
Usually trailing commas, single quotes, comments, or unquoted keys — all common when copying from JavaScript.
What is the difference between format and minify?
Format adds indentation for humans; minify strips all whitespace for the smallest size.
Is my JSON uploaded?
No. Parsing happens entirely in your browser.
More free tools
UUID Generator
Generate random v4 UUIDs in bulk.
Base64 Encode / Decode
Encode text to Base64 or decode it back.
Color Converter (HEX ↔ RGB)
Convert HEX to RGB and back, with live preview.
What Is My IP
See your public IP address instantly. No sign-up, nothing stored.
URL Encoder / Decoder
Encode or decode URLs and query strings.
Unix Timestamp Converter
Convert timestamps to dates and back.