json/jsonc
JSONC | JSONC Specification
About
- JSONC (JSON with Comments) is an extension of json that allows comments within JSON data. This specification defines the syntax and semantics of JSONC.
- The JSONC format was informally introduced by Microsoft to be used for VS Code's configuration files (
settings.json,launch.json,tasks.json, etc). Alongside the informal format, a publicly-available parser (jsonc-parser) was supplied to parse those configuration files. The goal of this specification is to formalize the JSONC format as whatjsonc-parserconsiders valid while using its default configurations. - JSONC follows the same syntax rules as JSON with the addition of JavaScript style comments. Comments can be either single-line or multi-line.
Comparison with json/5
- Both JSONC and json/5 extend JSON to support comments, but they have different approaches:
- JSONC is more conservative and maintains closer compatibility with standard JSON
- JSON5 is more permissive and allows more JavaScript-like syntax
#Example
Use Cases
Related
- json/5 - Alternative JSON extension with broader syntax support
- json - Standard JSON format
- jsonc-parser - Official parser implementation