JSON Formatter: How to Beautify, Validate, and Minify JSON
Kordu Team · 2026-03-31
Key Takeaways
- Beautifying adds indentation for readability. Minifying strips whitespace to cut file size by 30-60%.
- Trailing commas, single quotes, and unquoted keys are the three most common JSON parsing failures.
- Our browser-based formatter validates, beautifies, and minifies instantly -- no data leaves your machine.
- Beautify config files in version control (so diffs make sense). Minify API responses and stored payloads.
Format JSON Instantly
Paste or type JSON below to beautify, validate, or minify it. Errors are highlighted with exact line and character positions. Everything runs in your browser.
The Five JSON Errors You Will Hit Every Week
Even experienced developers trip over these constantly. They account for the vast majority of parsing failures.
Trailing commas
Valid in JavaScript, invalid in JSON:
{
"name": "Alice",
"age": 30,
}
The comma after 30 breaks every JSON parser. Remove trailing commas from the last element in every object and array.
Single quotes
JSON requires double quotes. Single quotes are rejected:
{ 'name': 'Alice' }
Unquoted keys
JavaScript allows { name: "Alice" }. JSON does not. Every key must be a double-quoted string.
Comments
JSON has no comment syntax. If you need comments, use JSON5 or JSONC (what VS Code’s settings.json uses), but standard parsers will reject them.
Wrong value types
undefined is not valid JSON. Neither are functions, NaN, or Infinity. Use null instead of undefined.
Invisible characters break parsing too
If your JSON looks correct but still fails, check for invisible characters. Copying from PDFs, Slack, or rich-text editors often introduces zero-width spaces or curly (“smart”) quotes that silently break parsing. Paste into the formatter above to detect them.
When to Beautify vs Minify
| Beautify (Pretty Print) | Minify (Compact) | |
|---|---|---|
| Purpose | Human readability | Machine efficiency |
| Whitespace | Adds indentation and newlines | Strips all unnecessary whitespace |
| Size impact | 30-60% larger | Smallest possible |
| Use case | Debugging, config files, docs | API responses, storage, network transfer |
| Readability | Excellent | Nearly impossible for large payloads |
Beautify anything humans read: config files in version control (so diffs are meaningful line-by-line), documentation examples, debugging output.
Minify anything machines consume: API responses, stored payloads, anything sent over a network. Stripping whitespace from a 50 KB response saves 15-20 KB, which compounds at thousands of requests per second. HTTP compression (gzip, Brotli) helps further, but starting smaller is always better.
JSON in Practice
API debugging
Browser DevTools show raw JSON in the Network tab, usually unformatted. Copy the payload, paste it into a JSON Formatter, and get instant syntax highlighting and structure. Pair with a Base64 Decoder for APIs that encode JSON payloads in Base64.
Config file errors
ESLint, TypeScript, Prettier, and package managers all use JSON config. When a build fails with a cryptic parse error pointing at your tsconfig.json, paste the file into a validator. It pinpoints the exact character faster than reading the file line by line.
Database storage
Storing JSON in PostgreSQL (jsonb), MongoDB, or DynamoDB? Minify before persisting to reduce storage costs. Validate on the application layer first. Beautify on read for UI display.
Structured logging
JSON Lines (NDJSON) outputs one JSON object per log line. When tailing logs, pipe individual lines through a formatter to make them readable. A browser-based formatter handles ad-hoc debugging faster than building a custom tool.
JSON Lines is not a JSON array
JSON Lines (NDJSON) is a sequence of independent JSON objects separated by newlines. Each line is valid JSON, but the whole file is not. Paste individual lines into a formatter, not the entire file.
Beyond Formatting: JSON Schema Validation
Formatting confirms syntax is valid. It says nothing about whether the data is correct. JSON Schema defines the expected structure — required fields, allowed types, value constraints — and validates documents against it.
A schema might require that a user object always has a string field called email and a number field called age between 0 and 150. If someone sends "age": "thirty", the schema validator catches it before your application code does.
If you work with JSON daily, learning JSON Schema is high-leverage. It catches bugs at the boundary before they propagate.
Use the Formatter
Bookmark our JSON Formatter. Paste your broken payloads. Stop debugging JSON syntax by hand.