Built and fact-checked by the DocNectar team — see our editorial standards
Key Features
Instant Calculation
Get accurate results in real time with our optimized algorithm.
Mobile Friendly
Fully responsive design. Works on all devices & screen sizes.
Privacy Focused
Your data stays on your device. We don't store any inputs.
100% Free
No hidden costs. This tool is completely free forever.
A single missing comma or an extra closing brace is enough to break a JSON parser, and the resulting error message isn't always specific about where the problem is. This formatter validates your JSON and, if it's invalid, tells you exactly what went wrong (PHP's own json_last_error_msg(), not a vague generic message). If it's valid, it pretty-prints it with the indent width you choose, minifies it to a single compact line, or sorts every object's keys alphabetically — whichever you need.
It's built for debugging API responses, cleaning up config files, and turning minified JSON back into something readable, without installing anything or pasting sensitive data into an unfamiliar site's clipboard-adjacent text box.
How it works
Paste your JSON into the input box, choose pretty-print or minify, set an indent width if you're pretty-printing, and optionally sort keys alphabetically. If the JSON is invalid, you'll get a specific parse error instead of a formatted result. If it's valid, you get the formatted output plus quick stats: size before and after, how many object keys it contains, and how deeply nested it is.
- Paste your JSON into the input box.
- Choose pretty-print (with an indent width) or minify.
- Optionally sort object keys alphabetically.
- Click Format to validate and see the result, or a specific error if it's invalid.
Examples
Minified API response
An API returns `{"user":{"id":1,"name":"Jane","roles":["admin","editor"]}}` on one line. Pretty-printing it with a 2-space indent turns it into a readable, properly nested structure in one click.
Invalid JSON from a hand-edited config file
A config file with a trailing comma — `{"debug": true,}` — fails to parse in strict JSON parsers. The formatter reports the specific syntax error instead of silently failing or showing a generic message.
Who should use it
- Debugging an API response by making it readable.
- Cleaning up or reformatting a hand-edited configuration file.
- Minifying JSON before embedding it somewhere size-constrained.
- Sorting keys to make two JSON documents easier to diff.
Industry applications
- API development and debugging
- DevOps and configuration management
- Frontend/backend integration work
- Data engineering and ETL pipelines
Advantages
- Gives a specific parse error instead of a generic "invalid JSON" message.
- Supports pretty-print with a custom indent, minify, and alphabetical key sorting in one tool.
- Reports size, key count and nesting depth alongside the formatted output.
Limitations
- Validates strict JSON only — doesn't support JSON5/JSONC comments or trailing commas.
- Doesn't validate against a JSON Schema, only that the syntax itself is well-formed JSON.
- Very large payloads (near the size cap) may be slower to process than a native desktop tool.
Common mistakes to avoid
- Using single quotes instead of double quotes around strings and keys — valid in JavaScript object literals, invalid in strict JSON.
- Leaving a trailing comma after the last item in an object or array.
- Forgetting to escape special characters (like unescaped quotes) inside string values.
- Mixing up JSON with JSON5/JSONC (which allow comments and trailing commas) — this tool validates strict JSON only.
Best practices
- Validate JSON before committing it to a config file or API contract, not after something downstream fails to parse it.
- Pick a consistent indent width across a project's config files rather than mixing tabs and varying space counts.
- Use minify mode for JSON that will actually be transmitted over the network, and pretty-print only for human reading/editing.
- Sort keys when diffing two versions of the same JSON structure — it makes the diff much easier to read.
Tips
- If you're not sure why your JSON is invalid, check for trailing commas and single-quoted strings first — they're the most common cause.
- Sort keys before diffing two versions of a JSON file in git — it turns a noisy diff into one that only shows actual changes.