JSON Formatter & Validator
Format, validate, and minify JSON. Paste or type JSON — see formatted output instantly with syntax validation.
Formatted output will appear here…What this formatter does
Paste JSON on the left and the right pane shows it indented. Validation runs on every keystroke rather than on a button press, so a missing comma surfaces while you are still looking at the line that caused it.
- Indent — 2 spaces, 4 spaces, or tabs; switching re-renders the output immediately.
- Format — rewrites the input pane with the indented version so you can keep editing from there.
- Minify — collapses the same data onto one line with no whitespace.
- Stats — key count, lines, characters, and size in KB once the JSON parses.
- Errors — the parser message plus the approximate line number, instead of a bare “invalid JSON”.
When to format, when to minify
- Format — while debugging an API response, editing a config file such as tsconfig.json or package.json, or reading a payload someone pasted into a ticket.
- Minify — before shipping JSON over the wire or into a column or env var. Dropping indentation often cuts 10–30% of the bytes.
Formatted — 2-space indent
{
"user": {
"id": 1,
"roles": ["admin"]
}
}Minified — same data, one line
{"user":{"id":1,"roles":["admin"]}}Formatting, validating, and schema validation
Three different jobs that get used interchangeably:
- Formatting changes whitespace only — the parsed data is identical before and after.
- Validating checks the text is parseable at all: quotes, commas, brackets. That is what the status bar above reports.
- Schema validation checks that already-valid JSON has the right fields and types. For that, use the JSON Schema validator.
Common JSON syntax errors
The validator catches these before they cause runtime failures:
- Trailing commas —
["a", "b",]is valid JS, not valid JSON - Single-quoted strings — JSON requires double quotes on both keys and values
- Unquoted keys —
{name: "Alice"}is JavaScript object syntax, not JSON - Comments — JSON has no
// commentsyntax unlike JSONC or JSON5 - Missing commas between properties or array elements
NaN,Infinity, andundefined— none are JSON values
Where your JSON goes
Nowhere. Parsing, formatting, and minifying all run in this page using the browser's built-in JSON.parse and JSON.stringify — there is no upload step and no request to a server. That is what makes it safe to paste a response that still contains a bearer token or customer records. If you would rather verify than trust: open DevTools, watch the Network tab, and type.
Related JSON tools
Frequently Asked Questions
Is this JSON formatter free?
Yes. There is no signup, no size limit imposed by the tool, and no paid tier. It is a static page that loads once and then runs offline.
Does it validate JSON, or only format it?
Both. Every keystroke re-parses the input, and the status bar reports either a green summary or the parser's error message with the approximate line number.
Is my JSON uploaded to a server?
No. Parsing, formatting, and minifying happen in the page using the browser's own JSON.parse and JSON.stringify. Open your DevTools Network tab while typing and you will see no requests.
Can I minify JSON here as well?
Yes. The Minify button rewrites the input as a single line with all whitespace removed. The data is unchanged — only the formatting differs.
What is the difference between formatting and validating JSON?
Formatting only changes whitespace. Validating checks that the text is parseable JSON at all. Invalid JSON cannot be formatted, which is why the error appears first.