JSON Validator
Validate and format JSON data instantly with this free client-side JSON validator tool. Check JSON syntax, detect errors, and beautify JSON directly in your browser.
Loading tool…
What makes JSON valid or invalid
JSON's specification (RFC 8259) is strict in ways that surprise people, largely because it looks like JavaScript but is not JavaScript. Keys must be double-quoted strings — no single quotes, no bare identifiers. Trailing commas after the last element are forbidden. Comments do not exist. Numbers cannot have leading zeros or hexadecimal notation. NaN and Infinity are not values. The whole document must be a single value, and it must be UTF-8.
A validator parses the text against that grammar and reports the first place it breaks, with a line and column. This matters because the failure downstream is usually cryptic: a config file that will not load, a deployment that fails with a stack trace pointing at a parser, or an API returning 400 with no explanation. Validating the document first turns a mysterious failure into a specific one-character fix.
Why we built this tool
Hand-edited files are where invalid JSON comes from — a package manifest, a CI pipeline definition, a cloud policy document, a translation file. One stray comma and everything stops.
Those same files often carry credentials, internal hostnames, and infrastructure detail. Checking them should not involve uploading them anywhere, so our validator runs the parse in your browser with no network call at all. Your document stays in the tab, the error report is generated locally, and nothing is stored. That also makes it fast enough to use as a reflex — paste, check, fix — and usable offline while you are working on a plane or inside a restricted network.
Tips and common mistakes
- JSON has no comments; a
//line copied from a JavaScript file will always fail validation. - Duplicate keys are technically permitted by the grammar but most parsers silently keep the last one, which hides real bugs.
- Check the file's encoding if validation fails on a document that looks perfect — a byte order mark at the start breaks strict parsers.
- Numbers with leading zeros, hexadecimal literals, NaN, and Infinity are all invalid, however reasonable they look.
Open JSON Validator with a link
Assistants and scripts can open JSON Validator with its input already in the link, after the #, which never leaves your device:
#text=— the text to work on#json=— the JSON document
Example: https://mygadgets.ink/tools/json-validator/#text=...&json=... · also compressed gz fields and ?url=. How tool links work
Quick start: using JSON Validator
- Paste the JSON you want to check into the input above.
- Run the validation; valid documents are confirmed immediately.
- If it fails, read the line and column in the error message and jump to that spot.
- Fix the usual suspects first: trailing commas, single quotes, unescaped quotes inside strings.
- Re-validate until it passes, then copy the corrected document back where it belongs.
Once it is valid, JSON Formatter makes it readable, and JSON to YAML converts it for tools that prefer YAML.
What validation checks
Validating confirms that your text is legal JSON: every bracket and brace is matched and closed, strings use double quotes, keys and values are properly separated, and there are no illegal trailing commas. If anything is off, the validator points to the location so you are not hunting blind.
The errors that catch everyone
JSON's rules are simple but unforgiving. The usual offenders:
- Trailing commas. A comma after the last item in an array or object is illegal in JSON, even though JavaScript allows it. This is the single most common mistake.
- Single quotes. JSON requires double quotes for both keys and string values.
'name'is invalid;"name"is correct. - Unquoted keys. Object keys must be quoted strings.
{name: "x"}fails;{"name": "x"}passes. - Missing commas between items, or a stray comma where none belongs.
- Comments. Standard JSON does not allow
//or/* */comments at all. - Unescaped characters inside strings, like a raw newline or an unescaped quote.
Why not just rely on your code?
By the time your application throws a JSON error, it is mid-crash and the message is usually generic ("unexpected token"). Validating the raw text first isolates the problem cleanly, before it reaches your code, and shows the precise character at fault.
Format while you fix
Pasting messy JSON into JSON Formatter makes structural errors visually obvious — indentation exposes an unclosed brace instantly. Validate to find the error, format to see it in context. Once clean, JSON to CSV or JSON to YAML can transform it.
Common uses
- Check a config file before deploying.
- Verify an API payload you hand-edited.
- Debug an "invalid JSON" error in your app.