Why VS Code lets settings files break JSON rules
Try loading a VS Code settings.json file, complete with comments and trailing commas, into a strict JSON parser. It stops cold. Those human-friendly touches make configs easier to read, but they also break compatibility outside the editor. Microsoft designed this behavior, drawing a clear line between developer convenience and the rigid rules of data interchange.
Since November 2017, VS Code has opened its config files in JSON with Comments (JSONC) mode. Users can add // line comments or /* ... */ block comments, and include trailing commas. RFC 8259, the official JSON standard, bans them all. Microsoft's reasoning is straightforward: config files are for people. Comments explain settings, while trailing commas make edits less error-prone. Pass one of these files to Python's json module or PowerShell's ConvertFrom-Json, though, and you hit a wall. Strict parsers reject anything outside the spec.
Why Microsoft bends the rules
Microsoft's editors deliberately treat files such as settings.json, tasks.json, launch.json, and tsconfig.json differently. The status bar shows what's allowed: open a generic .json file and you get strict mode. Open a recognized config file and the label switches to JSON with Comments. That setting determines whether notes and commas pass or get flagged. Parsing uses Microsoft's open-source node-jsonc-parser library, a impressive choice amid the ongoing debate about how open-source VS Code itself really is.
There's another wrinkle. Save a file as .jsonc and VS Code allows comments but warns about trailing commas. Save it as settings.json or tsconfig.json and those commas pass without complaint. The editor recognizes these files and quietly relaxes the rules, making hand-editing configs easier. It reflects how people actually use them: configs are constantly tweaked and annotated.
The limits of flexibility
But this rule-bending works only inside VS Code. Once a JSONC file leaves that environment, its quirks become a liability. Standard parsers such as Python's json module fail at the first comment or stray comma, throw a JSONDecodeError, and stop execution. Even inside VS Code, some files get no such leeway. package.json, which npm reads, stays in strict mode. One comment triggers a red error. App lists exported by Winget on Windows follow the same rule.
Supporters of strict JSON point out that comments and trailing commas encourage dialects such as JSONC, JSON5, and HJSON. Each has its own quirks. A file that works in one tool can fail in another. Microsoft keeps this flexibility within a clearly labeled mode and a defined set of files. The status bar is your warning: JSON with Comments means you can add notes and commas. Anything else is subject to strict enforcement.
What developers need to watch for
In practice, add comments freely to files labeled JSON with Comments. Before handing one to a script, API, or another tool, strip out comments and trailing commas. The rule-bending is deliberate and clearly marked, and stays within the editor's supported files. Developers get context in their configs while preserving strict compatibility when data leaves the editor. Once your settings are in place, it's worth checking which VS Code extensions can further simplify your process.
Microsoft bends the rules for developer convenience while keeping strict JSON as the default for data interchange, balancing pragmatism with discipline. The official RFC 8259 specification says JSON does not permit comments or trailing commas, so files containing them are not valid JSON. That strictness ensures interoperability across platforms and programming languages, and explains why VS Code limits its flexibility to its own configuration environment.
VS Code's documentation is clear: JSON with Comments mode is reserved for specific config files such as settings.json, tasks.json, and launch.json. Comments are allowed, and trailing commas are usually tolerated, sometimes with a warning. The distinction matters when sharing or processing these files outside VS Code.