json - 在 VS Code 中,禁用错误 "Comments are not permitted in JSON"

标签 json visual-studio-code comments

我有时使用 Visual Studio Code 来编辑包含注释的 JSON 文件。 VS Code 显示一条错误消息,“JSON 中不允许评论”。最好禁用该错误消息(无需删除评论。)

enter image description here

最佳答案

按照以下步骤操作:

  1. 点击右下角的字母 JSON。 (将出现“选择语言模式”下拉菜单。)
  2. 选择“为‘.json’配置文件关联...”

enter image description here

  1. 输入 jsonc 并回车。

enter image description here

如果您只想禁用单个文件的错误消息,请跳过第 2 步。

关于json - 在 VS Code 中,禁用错误 "Comments are not permitted in JSON",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47834825/

相关文章:

objective-c - Objective C 中的 __NSSingleObjectArrayI 是什么意思?当我尝试阅读 Json

java - 为什么在 android 中提取 Json 会出现异常?

c# - Visual Studio Code 中的 MVC 6 无法识别 ViewModel

visual-studio-code - 如何去除 VSCode v1.28.2 中的调试红点

visual-studio-code - 在Visual Studio Code中显示git分支

java - 代码中的注释会增加程序的时间复杂度吗?

python - Pandas 打开 json 文件 JSON -ValueError : Expected object or value

json - 用于 JSON 数据的 Jasper Reports 数据源

html - 为什么 "<! --"注释掉一条样式规则,而 "<!--"却没有?

css - 如何在 Facebook 评论框插件上应用自定义 CSS