JSON Validator — Lint & Fix JSON Errors Online
Broken JSON is one of the most frustrating debugging experiences. Our JSON validator instantly identifies syntax errors, shows the exact line and character position of the problem, and highlights what's wrong — so you can fix it in seconds.
Tips
Common JSON errors
The most frequent JSON errors are: trailing commas after the last item, single quotes instead of double quotes for strings, and missing commas between key-value pairs.
JSON vs JavaScript object syntax
JSON is stricter than JavaScript objects. All keys must be quoted with double quotes, and functions, undefined, and comments are not valid JSON values.
Test API responses
Paste raw API responses here to quickly validate that your endpoint returns valid JSON before processing it in your application.
Error messages explained
"Unexpected token" usually means a missing comma or bracket. "Unexpected end of JSON" means a bracket or brace was never closed.
JSON Formatter & Validator
DeveloperFormat, beautify, and validate JSON data online — free JSON linter.
About this tool
What is the JSON Formatter & Validator?
The JSON Formatter & Validator takes raw, minified, or malformed JSON and does two things: formats it into a readable, indented structure, and validates it for syntax errors. Both happen instantly as you type or paste.
It's one of the most-used tools in everyday web development — JSON is everywhere (APIs, config files, databases, logs), and it's frequently encountered in a compressed or broken state that's nearly impossible to read or debug without formatting it first.
How to Use the Formatter
- Paste your JSON into the input editor. This can be minified single-line JSON, a copied API response, a log entry, or anything else.
- Click Format to apply indentation and line breaks, making the structure visible and readable.
- Check for errors. If the JSON has a syntax error, the validator highlights the problem and shows the line and character position where parsing failed.
- Copy the output using the copy button. You can also minify the formatted JSON back to a compact form using the Minify option.
Formatting vs Validation
Formatting (also called beautifying or pretty-printing) adds consistent indentation and line breaks to make the structure readable. It doesn't change any data — only the whitespace.
Validation checks whether the JSON is syntactically valid according to the JSON specification. Common errors it catches:
- Trailing commas after the last item in an object or array — valid in JavaScript but not in JSON
- Single-quoted strings — JSON requires double quotes for all strings and keys
- Missing commas between key-value pairs
- Unmatched or missing brackets and braces
- Unquoted keys — all JSON keys must be strings in double quotes
- Invalid values —
undefined, functions, and comments are not valid JSON
When an error is detected, the tool pinpoints the exact location so you can fix it without scanning the entire document.
Minification
The Minify option removes all whitespace from the JSON, producing the most compact possible representation. Minified JSON is appropriate for:
- API responses where bandwidth matters
- Storing JSON in a database field
- Embedding JSON in source code as a string literal
- Any context where the JSON will be machine-read rather than human-read
Always keep a formatted version for development and version control — only minify the output that goes to production.
Common Use Cases
Debugging API responses — paste a raw API response to instantly see its structure, find the field you're looking for, and confirm the data shape matches your expectations.
Fixing broken JSON — when a JSON string is failing to parse in your application, paste it here to find the exact syntax error.
Config file editing — format configuration files (package.json, tsconfig.json, Terraform output) before editing to make the structure clear.
Learning JSON structure — see how nested objects, arrays, and different value types are represented and formatted.
Privacy
All formatting and validation happens in your browser. No JSON data is sent to any server or stored anywhere.
Discussion
Join the discussion
Sign in to share your thoughts and engage with the community.