JSON5 / JSONC to JSON.
Convert JSON5 or JSON with comments (tsconfig, VS Code settings) to strict, standard JSON.
Runs in your browserAbout JSON5 / JSONC to JSON
JSON5 / JSONC to JSON turns relaxed JSON dialects into strict JSON that any parser accepts. JSONC is the "JSON with comments" used by tsconfig.json, VS Code settings and many editor configs: it allows // and /* */ comments and trailing commas, and nothing else. JSON5 goes further and follows ECMAScript 5 literals: unquoted keys like name: 'demo', single-quoted strings, hexadecimal numbers such as 0x1F90, numbers with a leading or trailing decimal point, an explicit plus sign, line continuations inside strings, and the values Infinity and NaN. The converter parses the whole document with a full JSON5 1.0 grammar, so it does not simply delete everything that looks like a comment: a URL such as "https://example.com" inside a string survives intact, which is the classic bug of regex-based comment strippers. The output is re-serialized with the indent you pick, or minified with 0. Strict JSON has no Infinity or NaN, so you choose what happens to them: replace them with null (what JSON.stringify does), keep them as strings, or stop with an error so you notice them. Duplicate keys are allowed, the last one wins, and the stats panel counts them because they are usually a copy-paste mistake. Syntax errors are reported with a line and column. Pick JSONC mode when you want the converter to reject JSON5-only syntax, for example to check that a tsconfig file still works with tools that only understand comments. Everything runs in your browser and nothing is uploaded.
How to Use
- Paste a JSON5 or JSONC document and choose the input syntax.
- Pick the indent and what to do with Infinity and NaN.
- Copy or download the strict JSON.
Frequently Asked Questions
What is the difference between JSON5 and JSONC?
JSONC is JSON plus comments and trailing commas. JSON5 also allows unquoted keys, single quotes, hex numbers, Infinity, NaN and a few other ECMAScript 5 features.
Will comment-like text inside strings be removed?
No. The input is parsed, not searched with regular expressions, so "//" or "/*" inside a string value is kept exactly as written.
What happens to duplicate keys?
The last value wins, as in JavaScript. The stats panel shows how many duplicates were found so you can clean them up.
Is my data uploaded?
No. The conversion runs in your browser and the page makes no network requests while you use it.
Related Tools
Pretty print, minify, and validate JSON.
Fix broken JSON — trailing commas, single quotes, comments, missing brackets — and see every repair made.
Compare two JSON documents and see every added, removed and changed value by path.
Convert between YAML and JSON formats.
Escape and unescape strings for different formats.
Test regular expressions with match highlighting.