JSONC to JSON
Convert JSONC and JSON5 to strict JSON
Paste JSONC or JSON5 or load an example to convert it to strict JSON.
JSON, JSONC and JSON5
JSON is the strict format defined by RFC 8259. JSONC adds comments and, in practice, trailing commas; it is used by VS Code settings, tsconfig.json and many config files. JSON5 goes further with unquoted keys, single quotes, hexadecimal numbers, leading or trailing decimal points and Infinity or NaN. This tool accepts JSONC and the common JSON5 syntax and always writes strict JSON.
How to use
- 1.Paste the text, upload or drop a .jsonc, .json5 or .json file, or load one of the examples.
- 2.Choose the indentation. Small inputs convert as you type; from 2 MB, select Convert.
- 3.The status line lists what changed, for example comments removed or keys quoted.
- 4.Copy the output or download converted.json.
What is removed or normalized
- •Comments are removed. They are not part of JSON, so keep the original file if you need them.
- •Trailing commas are removed and keys get double quotes.
- •Single-quoted strings become double-quoted, with escapes such as \x41 or line continuations decoded.
- •0xFF becomes 255, +1 becomes 1, .5 becomes 0.5 and 5. becomes 5.
- •Duplicate keys keep the last value, like JSON.parse, and each duplicate is listed with its line.
Precision, errors and privacy
Numbers are never converted to JavaScript floats, so large integers and long decimals keep every digit. Infinity and NaN cannot be represented in strict JSON, so they stop the conversion with their location instead of becoming null. Errors show the line, column and a source excerpt. Input is limited to 5 MB and 256 nesting levels, and everything runs in your browser.
