JSON5 / JSONC to JSON Converter

Convert JSON5 or JSONC to strict JSON: comments, trailing commas, unquoted keys and single quotes are all handled.

Strict JSON output

Paste JSON5 or JSONC above to see strict JSON instantly.

No uploads. Your files stay on your device.

Free forever, no sign-up, no cookies. Buy me a coffee

How it works

This page runs a hand-written parser for the JSON5 1.0.0 grammar (json5.org), which is a strict superset of JSON and covers the JSONC dialect used by tsconfig.json, VS Code settings and devcontainer.json. It accepts // and /* โ€ฆ */ comments, trailing commas, unquoted (ECMAScript identifier) keys, single-quoted strings, escaped line continuations, \x41 and \u0041 escapes, hexadecimal numbers such as 0xdecaf, leading and trailing decimal points (.5, 5.), an explicit + sign, and Infinity, -Infinity and NaN. The result is re-serialised as RFC 8259 JSON while you type: every key gets double quotes, every string is re-escaped, and the comments and trailing commas are dropped because JSON cannot represent them.

Integers longer than a JavaScript double can hold exactly are copied through verbatim, so a value like 12345678901234567890 keeps every digit instead of being rounded. The two things JSON genuinely cannot express are reported rather than hidden: Infinity and NaN become null with a warning, and duplicate object keys collapse to the last value, also with a warning. Parse errors name the line and column of the offending character. Everything runs in your browser in plain JavaScript, so config files containing hostnames, tokens or internal URLs are never uploaded anywhere.

Frequently asked questions

What is the difference between JSON5, JSONC and JSON?

JSON is the strict RFC 8259 format: double-quoted keys and strings, no comments and no trailing commas. JSONC adds // and /* */ comments plus trailing commas, and is what tsconfig.json and VS Code settings use. JSON5 goes further with unquoted keys, single-quoted strings, hexadecimal numbers, leading and trailing decimal points and Infinity or NaN. This tool reads all three and writes strict JSON.

Does it remove comments from tsconfig.json?

Yes. Paste a JSONC file such as tsconfig.json, devcontainer.json or a VS Code settings file and the output is the same data as strict JSON with every // and /* */ comment and every trailing comma removed, ready for a parser that only accepts plain JSON. Because it is a real JSON5 grammar parser and not a regular expression, a // inside a string value is left alone.

What happens to Infinity, NaN and very large numbers?

JSON cannot represent Infinity or NaN, so they become null and the page warns you it did that instead of failing silently. Integers too long for a JavaScript double, such as 12345678901234567890, are copied through digit for digit so nothing is rounded away.

Report a bug