FormatterHQ

JSON5 Validator

Check a JSON5 file for syntax errors with exact line and column, find out whether it is also valid strict JSON, and convert it to JSON once it passes.

Input JSON5
Output JSON5
Ready.

How to use the JSON5 Validator

  1. Paste the JSON5 document or upload the file; Sample loads an example config.
  2. Click Validate JSON5. With Auto update on, the check reruns as you type.
  3. Fix any error at the line and column shown in the status bar.
  4. Optionally click Convert to JSON to get a strict JSON copy, using the chosen Indent.

A JSON5 validator with clear results

This JSON5 validator parses your document with the reference JSON5 parser and tells you whether it is valid. Because JSON5 is looser than JSON, a normal JSON validator rejects perfectly good JSON5 files, while a text editor may not catch a real mistake. Here you get a definite answer and the exact position of the first problem.

The three possible results

Status barMeaning
Valid JSON5 (also valid strict JSON) ✓The document uses no JSON5 extensions. Any JSON parser can read it.
Valid JSON5 ✓It relies on at least one JSON5 feature, such as a comment, an unquoted key or a trailing comma. Only JSON5-aware tools can read it.
invalid character … at line:columnA syntax error, with its line and column.

The difference between the first two is useful when you are unsure whether a file will work with a strict parser.

Example

A missing comma is the classic error in hand-edited config:

{
  name: 'dashboard'
  debug: false,
}

The validator reports invalid character 'd' at 3:3: the parser expected a comma or a closing brace before debug on line 3. Add the comma after 'dashboard' and the result becomes "Valid JSON5 ✓", with the document shown reformatted in the output panel (comments are left out of that view).

Errors JSON5 still does not allow

JSON5 is relaxed, but not anything goes. These are rejected:

  • Two commas in a row, as in {a:1,,}. Only one trailing comma is allowed.
  • Hyphens in unquoted keys, such as log-level: 1. Keys must be valid identifiers or be quoted.
  • Leading zeros, as in 01. Hex like 0x1F is fine.
  • undefined, which is a JavaScript value, not a JSON5 one.
  • An unescaped apostrophe inside a single-quoted string: write 'it\'s' or use double quotes.
  • An unclosed block comment or bracket, reported as invalid end of input.

Where JSON5 files come from

JSON5 is used for hand-maintained configuration in JavaScript tooling. Babel, for example, parses its .babelrc files as JSON5, which is why they may contain comments. Files in the "JSON with Comments" style used by VS Code settings and tsconfig.json generally validate as JSON5 too, because JSON5 permits their comments and trailing commas.

To restyle a valid file, use the JSON5 formatter. For plain JSON documents, the JSON validator checks against the stricter grammar. Validation runs in your browser, and the file is not uploaded.

Frequently asked questions

What is the difference between JSON and JSON5 validation?
A JSON validator rejects comments, single quotes, unquoted keys, trailing commas and special numbers like Infinity. The JSON5 validator accepts all of those and reports whether the file would also pass strict JSON.
Why does the error say "invalid character"?
The parser met a character that cannot appear at that position, for example a key where it expected a comma. The line and column point to that character; the actual mistake is often just before it.
Is every JSON file valid JSON5?
Yes. JSON5 is a superset of JSON, so any valid JSON document passes, and the status bar marks it as also valid strict JSON.
Can I turn a valid JSON5 file into JSON?
Yes. Click Convert to JSON. Comments and trailing commas are removed, keys are double-quoted, and Infinity or NaN values become null because JSON cannot represent them.

Last updated September 26, 2026

Related tools

JSON5 Formatter Format and beautify JSON5 with comments, unquoted keys and trailing commas, or convert JSON5 to strict JSON. Credit Card Validator Check credit card numbers with the Luhn algorithm, detect Visa, Mastercard, Amex and more, and verify length. Runs 100% locally. CSS Validator Validate CSS online: find unclosed braces, missing semicolons and other syntax errors. Email Address Validator Check email address syntax in bulk and flag typos in popular domains, disposable providers, role accounts and duplicates. HTML Validator Validate HTML markup online and find unclosed, mismatched or malformed tags. IBAN Validator Validate IBANs for 80+ countries with the MOD-97 checksum and country length rules, and see bank code and account parts. JSONL to JSON Converter Convert JSON Lines (JSONL / NDJSON) into a formatted JSON array. Invalid lines are reported with their line number. JSONPath Tester Test JSONPath expressions online against your JSON. Supports filters, wildcards, recursive descent and slices, returning values or paths. String to JSON Converter Convert an escaped JSON string back into formatted JSON. Handles quoted literals, backslash-escaped text and double-encoded JSON. JSON Graph Visualizer Visualize JSON data as a graph of connected nodes. See objects, arrays and values as a diagram of linked boxes with size badges. jq Playground Run jq filters on JSON in your browser with real jq 1.8: live output, -r -c -s -n -S and --arg options, clear errors and a clickable cheat sheet. JSON Cleaner Clean JSON by removing null values, empty strings, empty arrays and empty objects at any depth. Optionally trim whitespace in strings.