JSON Validator
Paste any JSON. The status line says ✓ valid or ✗ with the parser's error message and offset.
What "valid JSON" means
JSON is defined by RFC 8259. Valid JSON consists of:
- An object (
{...}) or array ([...]) at the top level — or any single value (string, number, boolean, null), per RFC 8259. - Object keys as double-quoted strings.
- Values: object, array, string (double-quoted), number,
true,false, ornull. - No trailing commas.
- No comments.
- No
NaN,Infinity, or-Infinity— JSON has no IEEE-754 special values. - Strings must be valid UTF-8 (or Unicode-escaped via
\uXXXX).
What's NOT valid JSON
Common things people confuse for JSON:
- JavaScript object literals —
{name: "Alice"}is JS, not JSON. Keys need quotes. - JSONC / JSON5 — comments and trailing commas are convenient but technically not JSON.
- NDJSON / JSON Lines — multiple JSON values separated by newlines. Each line is JSON; the whole file is not.
- Python dict repr —
{'name': 'Alice'}uses single quotes; not JSON. - Anything from a templating system that interpolated unescaped data —
{"name": "{{user.name}}"}may have unescaped quotes inside.
Reading parser errors
Browser JSON.parse errors are concise. Examples:
| Error | Likely cause |
|---|---|
Unexpected token } in JSON at position 47 | Trailing comma before } or ] |
Expected double-quoted property name | Unquoted key or single-quoted key |
Unexpected end of JSON input | Truncated — missing closing brace or bracket |
Unterminated string in JSON | Newline inside a string, or missing closing quote |
Unexpected number in JSON | Leading zero (0123) — JSON doesn't allow it |
Validating in code
// JavaScript / TypeScript
function isValidJson(s) {
try { JSON.parse(s); return true; }
catch { return false; }
}
// Python
import json
def is_valid(s):
try: json.loads(s); return True
except json.JSONDecodeError: return False
// Bash with jq
echo "$INPUT" | jq empty 2>/dev/null && echo valid
// Go
import "encoding/json"
var v interface{}
err := json.Unmarshal([]byte(input), &v)
Beyond syntactic validation
"Valid JSON" only means parseable. To enforce shape (this object
must have a name string and an age integer),
use JSON Schema or
a runtime validator like Zod
(TypeScript) or Pydantic (Python).
FAQ
What's the difference between this and the formatter?
Same engine — both use the browser's JSON.parse. The validator page just frames the UX around 'is this valid?' rather than 'show me the formatted output'. The status line is the answer either way.
Does it validate against a JSON Schema?
No — this tool checks syntactic validity (is the input parseable?). For schema validation against a contract, you need a JSON Schema validator. We're considering adding one as a separate tool; sign up below to be notified.
What error messages will I see?
Whatever your browser's JSON.parse emits — typically 'Unexpected token X at position N' or 'Expected double-quoted property name'. The position is a byte offset; line numbers aren't shown but you can usually find the spot from the offset.
Are JSONC, JSON5, NDJSON valid here?
No — strict JSON only. JSONC (with comments), JSON5 (looser syntax), and NDJSON (newline-delimited) are different formats. The strict validator will reject them at the first non-standard character.