Free tools Windows power users keep installed
One-click scans. No signup required.
iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
VS Code may accept comments and trailing commas in a file that looks like JSON because it can be editing the file in JSON with Comments mode, or JSONC. Those features are not valid in strict JSON. VS Code’s regular JSON mode and JSONC mode are distinct, and the active language mode determines which syntax the editor accepts.
JSON and JSONC are different language modes
VS Code provides a default JSON mode and a separate JSON with Comments mode, identified as jsonc. JSONC is intended for VS Code configuration files such as settings.json, tasks.json, and launch.json. It allows JavaScript-style line comments and block comments, as well as trailing commas. These additions make configuration files easier for people to maintain, but they are not part of strict JSON.
For example, JSONC permits comments like these:
{
// Choose the editor behavior
"editor.tabSize": 2 /* indentation width */
}
It also permits a comma after the last item in an object or array:
{
"editor.tabSize": 2,
}
Microsoft’s VS Code JSON documentation says trailing commas are discouraged and the editor displays a warning. That warning matters: an application or parser that expects strict JSON may reject a JSONC file, including one with a trailing comma or comment.
#1 Best Overall
Check the file’s active language mode
The filename alone does not explain every syntax diagnostic. Look at the language-mode indicator in VS Code’s status bar. Select it to see or change the active mode. If VS Code is treating a file as JSONC, comments may be accepted even though the content would fail a strict JSON parser. VS Code also lets you configure associations between file extensions and language modes.
Use JSONC only when the tools that read the file support it. For data exchanged with systems that require strict JSON, remove comments and trailing commas and use JSON mode or another strict-JSON validation step.
Syntax acceptance and schema validation check different things
The language mode controls which syntax VS Code accepts. JSON Schema validation is a separate layer: it can check a document’s structure and values against an associated schema and report diagnostics, but it does not turn JSONC syntax into strict JSON. The json.validate.enable setting controls JSON validation.
VS Code supports JSON Schema drafts 4 through 7, with limited support for drafts 2019-09 and 2020-12. A schema can be associated with a file in several ways:
Rank #3
- Add a
$schemaproperty to the document. - Map the file to a schema in user or workspace settings with
json.schemas. - Use a schema mapping contributed by an extension.
A $schema property is explicit, but it becomes part of the file’s data. A downstream consumer may reject that extra property or interpret it differently. If the consumer expects only application data, a json.schemas mapping in settings can associate the schema without adding a key to the document. See Microsoft’s documentation on JSON schema mapping and validation.
Choose settings scope based on who needs the configuration
VS Code settings can be user-scoped or workspace-scoped. User settings apply to your VS Code setup; workspace settings apply to a project and are stored under its .vscode directory, so they can be shared with the project. The settings.json file provides IntelliSense, and VS Code highlights errors such as incorrect setting names or JSON formatting. Microsoft explains the distinction in its User and workspace settings documentation.
Why the editor permits it—and what the documentation establishes
The practical explanation is that VS Code offers JSONC as a distinct mode for configuration files, not that strict JSON has changed. The official documentation confirms the modes and their behavior, but does not establish when JSONC was introduced or document the original design rationale. So the apparent leniency is intentional as a feature of JSONC; claims about its history or the precise motives behind its creation go beyond what that documentation says.
Recommended Free Tools
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

