JSONC (JSON con Comments) Specification
JSONC es JSON con línea y bloque comments, usado por VS Código y TypeScript configuración archivos.
Comment Support
JSONC extends JSON with // line comments and /* block comments */. No other syntax changes are made; trailing commas and unquoted keys remain disallowed. The format is used by VS Code settings, tsconfig.json, and other configuration files. JSONC parsers strip comments before standard JSON parsing. The format is a minimal, pragmatic extension for configuration.
- line comments
- // style
- block comments
- /* */ style
- no other changes
- Strict JSON otherwise
VS Code settings tsconfig.json minimal extension Parsing Strategy
Most JSONC implementations preprocess input to remove comments before JSON.parse. TypeScript provides native JSONC parsing via tsconfig APIs. VS Code has a built-in JSONC parser with schema validation. The format is not suitable for data interchange due to non-standard parsers. For programmatic config, JSONC offers the simplest extension over JSON.
- preprocess
- Strip then parse
- TypeScript
- Native parse API
- VS Code
- Built-in parser
common approach ts.readConfigFile jsonc-parser