JSON Comments Stripper (JSONC → JSON)

JSONC (JSON with Comments) is used by VS Code config, tsconfig.json, and others. Standard JSON parsers reject the comments. This tool strips // and /* */ comments correctly — without breaking strings that contain // or /*.

How to use the JSON Comments Stripper (JSONC → JSON)

Paste JSONC — JSON with // line comments and /* */ block comments. The tool strips them while leaving comment-like sequences inside strings (a URL containing //, say) untouched. Keep the trailing-commas option checked to also remove dangling commas, producing JSON a strict parser will accept.

Stripping comments from JSONC

Plenty of tools let you write comments in their JSON config — tsconfig.json, VS Code’s settings.json, and others accept the JSONC dialect with // and /* */ notes. But the standard JSON.parse and most JSON libraries reject those comments outright, so a config that works in your editor fails the moment another program tries to read it.

This removes both comment styles — and, optionally, trailing commas — to turn JSONC back into strict JSON, while being careful not to mangle // or /* sequences that appear inside string values. Once stripped, the strict JSON validator confirms the result parses cleanly under RFC 8259.

Common use cases

  • Feed a strict parser — convert a commented config so JSON.parse accepts it.
  • Clean tsconfig — strip notes from a tsconfig.json before another tool reads it.
  • Drop trailing commas — remove the dangling commas JSONC allows but JSON forbids.
  • Preserve URLs — keep https:// and other // inside strings intact.
  • Pipeline prep — sanitise hand-edited JSONC before a build step parses it.

Frequently asked questions

Does it break strings that contain // or /*?

No — it tracks string boundaries, so a URL or any text containing comment markers inside a string is left untouched.

Can it remove trailing commas too?

Yes — the trailing-commas option strips dangling commas, which JSONC permits but strict JSON does not.

What is JSONC?

JSONC is JSON with Comments — the dialect used by tsconfig.json, VS Code settings, and similar config files.

How do I confirm the output is valid?

Run it through the strict JSON validator to check it parses under RFC 8259.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: