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.parseaccepts it. - Clean tsconfig — strip notes from a
tsconfig.jsonbefore 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.