jsonvisual-studio-codecomments

In VS Code, disable error "Comments are not permitted in JSON"


I sometimes use Visual Studio Code to edit JSON files that include comments. VS Code displays an error saying, "Comments are not permitted in JSON." It would be nice to disable that error message (without having to remove the comments.)

enter image description here


Solution

  • Follow these steps:

    1. Click on the letters JSON in the bottom right corner. (A drop-down will appear to "Select the Language Mode.")
    2. Select "Configure File Association for '.json'..."

    enter image description here

    1. Type jsonc and press Enter.

    enter image description here

    If you only want to disable the error message for a single file, skip step #2.