Understanding JSON5
The relaxed cousin of JSON.
What JSON would have been if it weren't a strict subset of JavaScript object literals.
What JSON5 adds.
JSON5 is a small extension of JSON. It adds the conveniences that human-edited JSON config files desperately wanted: trailing commas, single-line and multi-line comments, single-quoted strings, unquoted keys, NaN and Infinity as numbers, hexadecimal numbers. Every valid JSON document is also a valid JSON5 document.
Where JSON5 lives.
Babel config, Webpack config, Jest config — anywhere a .json file is read by JavaScript tooling, JSON5 tends to show up. package.json is strict JSON; tsconfig.json, .eslintrc.json, and jsconfig.json all accept JSON5 (TypeScript and ESLint specifically allow comments). The convenience of writing a comment next to a config option is the whole reason the dialect exists.
What this formatter does.
The formatter takes JSON5 input — comments, trailing commas, single quotes, unquoted keys — and emits clean, strict JSON. The auto-fix on upload uses the same logic: it strips JSON5-only syntax and outputs a document that any JSON parser will accept. Going the other way (from strict JSON to JSON5) isn't useful — strict JSON is already valid JSON5.
The cleaner's limits.
Real-world configs sometimes contain things the cleaner can't recover: NaN and Infinity have no valid JSON representation, hex numbers (0xFF) need to be expanded to decimal, backtick template literals aren't part of JSON5 anyway. For those exotic cases, you'll need a full JSON5 parser locally — this formatter focuses on the 95% of inputs that are config files lightly relaxed from strict JSON.