Free JSON Validator
Find JSON syntax errors with exact line and column. Auto-fix common issues like trailing commas, single quotes and unquoted keys — all in your browser.
Input JSON
Diagnostics
Ready to validate
Paste JSON on the left to see the analysis hereWhat Is JSON Validation?
JSON validation checks whether a piece of text conforms to the official JSON specification (RFC 8259). Valid JSON can be parsed by any JSON library in any programming language; invalid JSON causes parse errors in applications, breaks API calls, and corrupts configuration files.
This validator uses the browser's native JSON.parse to determine validity, and then translates the resulting error messages into human-friendly diagnostics with exact line, column and context.
The most common JSON errors
| Error | Example | Auto-fix? |
|---|---|---|
| Trailing comma | {"a":1,} | ✅ Yes |
| Single quotes | {'a':'b'} | ✅ Yes |
| Unquoted key | {a: 1} | ✅ Yes |
| Comments | {"a":1} // note | ✅ Yes |
| Missing comma | {"a":1 "b":2} | ❌ Manual |
| Unclosed bracket | {"a":1 | ❌ Manual |
| Invalid number | 01, .5, 1., 0x10 | ❌ Manual |
| NaN / Infinity | {"a":NaN} | ❌ Manual |
| BOM character | (invisible UTF-8 BOM) | ✅ Yes |
| Escaped control chars | "line\nbreak" (literal) | ❌ Manual |
Why is JSON so strict?
JSON was deliberately designed to have almost no flexibility. Where JavaScript allows single quotes, unquoted keys, trailing commas, comments, and even functions as values, JSON accepts none of these. The reasoning is:
- Simplicity. A minimal spec is easier to implement correctly in every language.
- Safety. No comments means no injection vectors. No functions means no code execution.
- Determinism. Two JSON strings with the same content are always byte-identical after canonical serialization.
The trade-off is that humans frequently write "almost-JSON" — JavaScript object literals, JSON5, JSONC, or YAML-style configs — and expect them to work. The parser correctly rejects these, which is why validators exist.
What the validator reports
For every invalid input, the validator provides:
- Error type — Syntax Error, Truncated, Invalid Character, etc.
- Exact location — line and column where the parser failed.
- Parser message — the browser's native error message, unmodified.
- Human hint — a plain-English explanation of what's likely wrong.
- Source context — the 3 lines before and after the error, with a marker under the exact column.
- Suggested fix — when the error matches a known pattern, an Auto-Fix button appears.
What Auto-Fix does
Auto-Fix applies targeted, non-destructive repairs for errors that have exactly one unambiguous solution:
- Trailing commas — remove commas before
}and]. - Single quotes — convert
'delimiters to"(respecting escapes). - Unquoted keys — wrap keys in double quotes.
- Comments — remove
// ...and/* ... */blocks. - BOM — strip a UTF-8 byte-order mark if present.
- Smart quotes — convert curly
"..."to straight"...".
Auto-Fix does not try to repair missing brackets or missing commas. Those are ambiguous — the fix would often be wrong, and silently producing wrong data is worse than reporting an error.
Structure analysis
When the JSON is valid, the validator goes beyond a simple "OK" and produces a structural overview:
- Root type — Object, Array, String, Number, Boolean or Null.
- Max depth — how many nested containers the JSON contains.
- Total nodes — the count of every object, array and value.
- Size — bytes and line count.
- Type distribution — badges showing how many of each primitive type appear.
This is useful for quickly sanity-checking an API response — spotting a suspiciously deep nested structure, or confirming that an array has the expected number of objects.
Common use cases
Debug API Errors
Find the exact syntax error that's causing an API integration to fail.
Config File Checks
Verify package.json, tsconfig.json or any config before committing.
Convert JS to JSON
Auto-fix turns JavaScript object literals into valid JSON.
Data Import Prep
Validate JSON before importing into a database.
Learn JSON Rules
See exactly which characters are accepted and which aren't.
Security Review
Verify that a JSON payload doesn't contain hidden syntax issues.
Structure Audit
Inspect depth and node counts of a large API response.
CI/CD Pipelines
Validate JSON artifacts before deployment.
Privacy and security
This JSON validator runs entirely in your browser. Validation uses the native JSON.parse; highlighting, error analysis and auto-fix are all local JavaScript. Your JSON never leaves your device. Safe for API keys, credentials, proprietary data, customer records and any other sensitive payload.