What does a JSON5 validator check that a JSON validator does not?
A JSON5 validator accepts five things strict JSON rejects: // and /* */ comments, trailing commas in arrays and objects, unquoted object keys (when keys are valid JS identifiers), single-quoted string values, and number extensions like hex (0xFF), leading/trailing decimal points (.5 or 5.), and explicit + signs. A JSON validator flags all of these as errors.
Why is my .babelrc failing JSON validation but passing JSON5 validation?
Babel parses .babelrc with a JSON5-aware parser, so comments and trailing commas work in production. A strict JSON validator like JSON.parse rejects them. Run the file through this JSON5 validator to confirm Babel will accept it; run it through a strict JSON validator only if you want to share it with tools that require RFC 8259 compliance.
Can it validate tsconfig.json?
Yes. tsconfig.json uses JSONC (JSON with comments only — no trailing commas in older TypeScript versions, allowed in newer ones). Every JSONC file is valid JSON5, so this validator accepts tsconfig.json without issue. For semantic schema validation (correct compiler options), run tsc --showConfig.
What does a typical validation error message look like?
Errors include the line/column where parsing failed and the reason — for example "Unexpected token at line 12, column 4" or "Unterminated string literal". Common causes: an unmatched bracket, a missing comma between properties, or a string opened with a single quote and closed with a double quote.
Does it validate against a schema?
No — this checks JSON5 well-formedness only. Schema validation (e.g. confirming a Babel preset name is recognized, or a tsconfig compilerOptions.target value is valid) requires JSON Schema with Ajv, or running the host tool itself in dry-run mode.
Are unquoted keys with hyphens or spaces allowed?
No. JSON5 allows unquoted keys only when they are valid ECMAScript identifiers (letters, digits, $, _, no hyphens, no spaces, not starting with a digit). Quote keys that contain hyphens, spaces, or unicode — e.g. "my-key" must be in quotes.
Is my JSON5 sent to your servers?
No. Validation runs entirely in your browser. Configuration files containing credentials, registry tokens, or proprietary build settings never leave your device. Verify in DevTools → Network — no requests are made when you click Validate.
How do I fix an "unexpected token" JSON5 error?
Look at the reported line and column, then check three things in order: (1) is every opening { [ matched by a closing } ]; (2) is every string properly closed in matching quotes (single or double); (3) is there a stray comma in a place JSON5 forbids — for example after a single value or before the opening of an array.