In VS Code, disable error "Comments are not permitted in JSON"
JsonVisual Studio-CodeCommentsJson Problem Overview
Json Solutions
Solution 1 - Json
Follow these steps:
- Click on the letters JSON in the bottom right corner. (A drop-down will appear to "Select the Language Mode.")
- Select "Configure File Association for '.json'..."
- Type
jsonc
and press Enter.
If you only want to disable the error message for a single file, skip step #2.
Solution 2 - Json
Add this to your User Settings:
"files.associations": {
"*.json": "jsonc"
},
If you don't already have a user settings file, you can create one. Hit Ctrl+, or ⌘+, (that's a comma) to open your settings, then hit the Open Settings (JSON) button in the upper right. It looks like this:
Solution 3 - Json
Just rename file to test.jsonc
Reasons to use JSONC
and not to allow comments in the regular JSON
files are:
- It will separate your file from real JSON files
- It is not going to bite you in the back when you add comment to a file where validation has to be applied, but you forget to remove comments because there is no error message.
- It is going to work out of the box on any setup without "tuning" someone's else VS Code.
Solution 4 - Json
enter json config demo in this picture
answer: enter associations
in VScode setting, add item *.json
jsonc
.
btw: What is your screenshot software? pleassssse tell me, and which font on screenshot img?