JSON5 Validator

Client-sideNo sign-upFree

Validate JSON5 - comments, trailing commas, unquoted keys, single-quoted strings - and see the equivalent strict JSON.

Quick facts

Category
Formatters & Beautifiers
Best for
Validating a hand-written JSON5 config file that uses comments and trailing commas
JSON5 input
✓ Valid JSON5
Parsed as standard JSON
{ "name": "Formatiq", "version": 1, "tags": [ "json5", "validator" ] }
JSON5 extends JSON with comments, trailing commas, unquoted object keys, single-quoted strings, and a few other conveniences aimed at hand-written config files. This tool parses with the real json5 library (not strict JSON.parse, which would reject all of that syntax) and shows the equivalent strict-JSON output alongside a pass/fail verdict. Need plain-JSON formatting instead? Use the JSON Formatter.
In-content slot
Was this tool helpful?
On this page

Overview

JSON5 relaxes JSON’s strict grammar for the sake of hand-written config files: it allows line and block comments, trailing commas in objects and arrays, unquoted (or single-quoted) object keys, single-quoted strings, and a handful of other conveniences that a strict JSON.parse would reject outright. This tool validates against the real JSON5 grammar using the JSON5 library rather than approximating it, so a config file with comments and trailing commas gets an honest pass/fail verdict instead of a false "invalid JSON" error from a parser that was never built to accept it. Valid input is also shown re-serialized as strict, standard JSON, so you can see exactly what a downstream JSON.parse-only consumer would receive. Runs entirely client-side; nothing you paste is ever uploaded.

Best for: Validating a hand-written JSON5 config file that uses comments and trailing commas

How to use this tool

  1. Paste JSON5. Comments, trailing commas, unquoted keys, and single-quoted strings are all accepted.
  2. Get a real verdict. Parsed with the JSON5 grammar, not a strict JSON.parse that would reject valid JSON5.
  3. See the strict-JSON equivalent. Valid input is re-serialized as standard JSON so you know what a plain JSON.parse consumer would see.

Frequently asked questions

They overlap but aren’t identical. JSON5 allows comments plus several other relaxations (trailing commas, unquoted keys, single-quoted strings, hex numbers, leading decimal points); JSONC as used by some tools (like VS Code’s settings files) typically only adds comments and trailing commas on top of JSON. This tool validates specifically against the JSON5 grammar.

Strict JSON.parse has no concept of comments, trailing commas, or unquoted keys at all - it throws a syntax error the moment it hits any of them. There’s no way to "ignore" that syntax with the standard parser; you need a parser that actually understands the JSON5 grammar, which is what this tool uses.

It validates and shows the strict-JSON equivalent of valid input, but it doesn’t reformat the original JSON5 source itself (which would require deciding how to preserve or restructure comments). For pretty-printing plain JSON, use the JSON Formatter.

Explore more free tools

Formatters, converters, validators, and generators - all free and running entirely in your browser.

Browse more tools