JSON5 Validator Online — Validate JSON5 Syntax

Validate JSON5 documents — comments, trailing commas, unquoted keys, single-quoted strings — for .babelrc, tsconfig.json, ESLint configs. 100% in your browser.

What is a JSON5 Validator?

A JSON5 validator checks whether a document is syntactically valid JSON5 — meaning a JSON5-aware parser (like Babel's, json5 npm package) can read it. Unlike a strict JSON validator, it accepts comments, trailing commas, unquoted keys, and single-quoted strings: the five extensions JSON5 layers on top of JSON.

If your .babelrc or tsconfig.json works locally but JSONLint flags it as invalid, you almost certainly have JSON5 syntax that strict JSON rejects. Run it through this validator to confirm — and to see the equivalent strict-JSON output.

How to validate JSON5 — 4 steps

  1. Paste your JSON5. Copy a config file with comments, trailing commas, or unquoted keys into the Input panel. Click Load Sample for a demo with every JSON5-specific feature.
  2. Click Validate. The validator parses JSON5 client-side and either confirms it is well-formed or surfaces the exact error.
  3. Read the error. Errors include the line/column and reason. Fix the issue and re-run.
  4. Inspect the normalised JSON. On success, the output shows the equivalent strict JSON, useful for testing or sharing with strict parsers.

JSON5-specific syntax accepted

JSON5 input (validates OK)

{
  // line comment
  name: 'app',          // unquoted key
  /* block comment */
  tags: [
    'web',
    'cli',              // trailing comma OK
  ],
  hex: 0xCAFE,
}

Normalised strict JSON

{
  "name": "app",
  "tags": [
    "web",
    "cli"
  ],
  "hex": 51966
}

JSON5-Aware Validation

Accepts // and /* */ comments, trailing commas, unquoted keys, single-quoted strings, and number extensions — every JSON5 feature.

Precise Error Location

Errors include the line and column where parsing failed plus a reason, so you can jump back to your editor and fix it without guessing.

Client-Side Only

JSON5 is parsed in your browser. Config files with credentials, registry tokens, or proprietary build settings never leave the device.

Common use cases

  • check_circleValidate a .babelrc or babel.config.json5 before committing to git
  • check_circleCheck tsconfig.json after manually editing compiler options
  • check_circleValidate an ESLint configuration file with comments justifying overrides
  • check_circleVerify a JSON5 config after a merge conflict resolution
  • check_circleCatch trailing-comma or missing-bracket errors before a CI build
  • check_circleValidate VS Code settings.json (JSONC) — every JSONC file is valid JSON5
  • check_circleConfirm a JSON5 file is well-formed before publishing to npm
  • check_circleLint JSON5 documents as part of a pre-commit hook or CI/CD pipeline

JSON5 validator vs JSON validator

A strict JSON validator implements RFC 8259 — no comments, no trailing commas, all keys quoted, only double-quoted strings. A JSON5 validator implements the JSON5 spec — every JSON file is valid JSON5, but not every JSON5 file is valid JSON. Use this validator for hand-edited config files (Babel, TypeScript, ESLint, VS Code) where comments matter; use a strict JSON validator for API payloads, configuration that crosses tool boundaries, and anything that must round-trip through a strict parser.

More than validating

Format, validate, parse, or convert JSON5 and JSON with the rest of OpenFormatter's tools — all browser-side.

Frequently Asked Questions

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.

JSON5 Validator Online — Validate JSON5 Syntax