JSONC → JSON
Strip comments and trailing commas from JSONC to produce valid RFC 8259 JSON. Used for VS Code settings, tsconfig.json, and other JSONC files.
What is JSONC?
JSONC (JSON with Comments) is an informal extension of strict JSON that adds two comment syntaxes borrowed from JavaScript: // single-line comments and /* … */ block comments. It also permits trailing commas in objects and arrays. Strict JSON (RFC 8259) allows neither — most JSON parsers will reject them.
Input
{
// Server configuration
/* The port must be free */
"host": "localhost",
"port": 3000,
"features": [
"auth",
"logging", // trailing comma OK
],
}Output
{
"host": "localhost",
"port": 3000,
"features": [
"auth",
"logging"
]
}Common JSONC file formats
| File | Tool / Ecosystem | What JSONC enables |
|---|---|---|
| settings.json | VS Code | Documenting each setting inline |
| tsconfig.json | TypeScript | Explaining compiler options |
| .eslintrc.json | ESLint (older format) | Rule rationale comments |
| devcontainer.json | Dev Containers | Setup step documentation |
| launch.json | VS Code debugger | Debug configuration notes |
| .babelrc | Babel (legacy) | Transform explanation comments |
Note: JSONC is supported natively by VS Code, TypeScript's
ts-node, and several build tools. When passing JSONC to tools that expect strict JSON (APIs, databases, CI pipelines), strip it first using this converter.JSONC vs JSON5 vs JSON
| Feature | JSON | JSONC | JSON5 |
|---|---|---|---|
| Comments | ✗ | ✓ | ✓ |
| Trailing commas | ✗ | ✓ | ✓ |
| Single-quoted strings | ✗ | ✗ | ✓ |
| Unquoted keys | ✗ | ✗ | ✓ |
| Multi-line strings | ✗ | ✗ | ✓ |
| Hex numbers | ✗ | ✗ | ✓ |
| Leading/trailing decimal | ✗ | ✗ | ✓ |
Warning: This tool targets JSONC specifically — comments and trailing commas only. If your input uses single-quoted strings, unquoted keys, or other JSON5 extensions, use the JSON Fixer instead, which handles a broader set of non-standard syntax.
Frequently Asked Questions
Your files stay on your computer. Dad promised.