How to Format and Validate JSON Online for Free
JSON is unforgiving. A single trailing comma or stray quote mark makes the entire document fail to parse, and the error message points to where the parser gave up — which is often several lines away from where the actual mistake is. Here's how to find and fix it quickly.
Validate and format in your browser (free, instant)
The JSON Formatter on keptlocal validates and reformats JSON using the browser's native parser.
- Paste your JSON into the input box.
- Choose an indent width — 2 spaces, 4 spaces, or tabs.
- Click Format & validate. Valid JSON prints back out cleanly indented; invalid JSON shows the specific error and its line/column position.
- Need the compact version instead? Click Minify.
The five most common JSON errors
In rough order of how often they actually happen:
- Trailing commas.
{"a": 1, "b": 2,}— valid in JavaScript object literals, invalid in strict JSON. This is the single most common breakage, especially when JSON is hand-edited from JavaScript code. - Single quotes. JSON strings and keys require double quotes.
{'key': 'value'}is valid JavaScript but not valid JSON. - Unquoted keys.
{key: "value"}is JavaScript shorthand; JSON requires every key to be a quoted string. - Smart quotes from a word processor. Pasting JSON out of Word, Google Docs, or a rich-text email client can silently convert straight quotes (
") into curly ones (""), which look nearly identical but break parsing. - Unescaped characters inside strings. A literal double quote, backslash, or newline inside a string value needs to be escaped (
\",\\,\n) — an easy thing to miss when hand-constructing JSON from a template.
Format vs. minify
Use format when a human needs to read the JSON — debugging an API response, reviewing a config change in a pull request, writing documentation. The indentation costs nothing when someone's going to read it once.
Use minify when the JSON is headed over a network or into a size-constrained field — an environment variable, a URL query parameter, a database column with a length limit. Stripping whitespace directly reduces payload size, which is why production APIs serve minified JSON by default; formatting is a development-time convenience, not something you'd ship.
Strict JSON vs. relaxed variants
Strict JSON (RFC 8259) is deliberately minimal — no comments, no trailing commas, no unquoted keys — and that minimalism is why it became the universal interchange format: it parses identically, with near-zero ambiguity, in every language. Some tools accept relaxed variants for convenience: JSON5 allows comments and trailing commas for hand-written config; JSONC (JSON with Comments) is what VS Code uses for its own settings files. If your input uses either of those and this tool flags it as invalid, that's correct behavior — it genuinely isn't standard JSON, even though a specific editor or library might tolerate it.
Privacy: what happens to your data
JSON payloads routinely contain API keys, tokens, or customer records. This tool never transmits what you paste — parsing and formatting run through the browser's built-in JSON.parse and JSON.stringify, locally, in the tab. Open DevTools → Network while using it and nothing fires.
Validate JSON now with keptlocal's free JSON Formatter — no upload, no signup. Generating test data? Try UUID Generator.
Frequently asked questions
Why does my JSON fail to parse even though it looks correct?
What's the difference between this and JSON5 or JSONC?
Can I use this on very large JSON files?
Does formatting change the data, only the whitespace?
Is my JSON uploaded anywhere to be checked?
Format, validate, and minify JSON — free, in your browser.
No upload. No signup. Runs in your browser.