Click on the letters JSON at the bottom in the right corner. Type jsonc to use the JSON with Comments file association.
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.
If you're having trouble adding comments to your JSON file, there's a good reason: JSON doesn't support comments.
json file. You can open the settings. json file with the Preferences: Open Settings (JSON) command in the Command Palette (Ctrl+Shift+P). Once the file is open in an editor, delete everything between the two curly braces {} , save the file, and VS Code will go back to using the default values.
Follow these steps:
jsonc
and press Enter.If you only want to disable the error message for a single file, skip step #2.
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:
Just rename file to test.jsonc
Reasons to use JSONC
and not to allow comments in the regular JSON
files are:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With