What is JSON5 and how does it differ from JSON?
JSON5 is a superset of JSON designed for human-edited config files. It permits // and /* */ comments, trailing commas, unquoted object keys, single-quoted strings, multi-line strings via backslash continuation, leading/trailing decimal points, hex numbers, and explicit + signs. Standard JSON.parse rejects all of these — JSON5 parsers accept them.
Which projects use JSON5?
Babel (.babelrc, babel.config.json5), some Webpack configs, JSON5-aware tools, and many internal config systems use JSON5 directly. TypeScript tsconfig.json and VS Code settings.json use JSONC (JSON with comments) which is a JSON5 subset — the formatter handles both.
Does the formatter preserve comments?
The formatter parses JSON5 and re-emits it as 2-space-indented JSON, which strips comments by design. If you need comments preserved, use a JSON5-aware library like the json5 npm package which supports round-trip formatting with comment retention.
Can I convert JSON5 to strict JSON?
Yes. The formatter output is strict RFC 8259 JSON — comments removed, trailing commas removed, keys quoted, strings double-quoted. Paste JSON5, click Run, and copy the output as a valid JSON file your strict parser will accept.
Why are trailing commas useful in config files?
Trailing commas reduce diff noise. Adding a new array or object element without a trailing comma changes two lines (the new line and the previous line which now needs a comma). With trailing commas, only the new line changes — making git history cleaner and merge conflicts rarer.
Is JSON5 faster or slower to parse than JSON?
Slower. JSON.parse is implemented natively in browsers and Node.js. JSON5 parsers are JavaScript libraries that run in user-space. For config files this is irrelevant (parsed once at startup); for hot-path data interchange always use strict JSON.
Is my JSON5 uploaded to your servers?
No. Formatting runs entirely in your browser. Config files containing API keys, registry credentials, or private build settings never leave your device. Verify by opening DevTools → Network and clicking Run — no requests are made.
How is JSON5 different from JSONC?
JSONC (used by VS Code and TypeScript) allows only comments — single-line and block. JSON5 is a strict superset that adds trailing commas, unquoted keys, single-quoted strings, and number extensions on top of JSONC. Every JSONC file is valid JSON5; not every JSON5 file is valid JSONC.