jsontoolskit.org
JSON and JSON Schema utilities, in the browser
Say hi →

JSONC to JSON

strip comments and trailing commas · tsconfig / VS Code settings · updated 28 July 2026

JSONC is JSON with comments — the dialect tsconfig.json, .vscode/settings.json and devcontainer.json use. This strips // and /* */ comments plus trailing commas, then validates the result, so you can feed the file to a parser that only speaks strict JSON.

Paste input to start.

How to strip comments from JSONC

  1. Paste your JSONC — a tsconfig.json, a VS Code settings file, or anything else with comments.
  2. The comments are removed and trailing commas dropped, then the result is parsed to confirm it is valid JSON.
  3. Pick an Indent, or choose Minified to get the smallest output.
  4. If the input is still invalid after cleaning, the status bar says why and the pane shows the stripped text so you can fix it by hand.
  5. Copy or download the strict JSON.

Comments inside strings are safe

The stripper tracks string literals, so a URL like "https://example.com//path" or a value containing /* survives untouched. Escape sequences inside strings are handled too — a \" does not end the string. This is the bug that naive regex-based comment strippers always have.

JSONC, JSON5 and plain broken JSON

Privacy

Nothing is uploaded. The conversion runs in this tab using your own browser's JavaScript engine — no server sees your data, and the page keeps working with the network disconnected.

FAQ

Which tools actually accept JSONC?

TypeScript, VS Code, the Dev Containers spec, and several Microsoft tools. Most other JSON parsers reject comments outright, which is why converting first is often easier than arguing with the parser.

Does it preserve my key order?

Yes. Keys are re-emitted in the order they appear. Use Sort keys if you want them alphabetical.

Why keep trailing commas as an option?

Because some targets accept them and you may only want the comments gone. It is off by default since strict JSON forbids them.