Possible Duplicate:
Can I comment a JSON file?

We are using a .json file on a project. We want to know if we can add comments to the file and avoid crashing the JSON parser.

We've tried to do so with the following comment types, but they all crash the JSON file when it's parsed:

# I crash
// I crash
/* I crash */

Is there an acceptable form of commenting for JSON files?

推荐答案

JSON不支持注释——仔细想想,这很好.然而,有人制作了JSON5(https://github.com/aseemk/json5),它确实如此,并且可能对您有用.

It's worth pointing out that this is just someones JSON-like project, and is not an official spec, but then I guess JSON is just someones XML-like project that people liked :)

Json相关问答推荐

如何在Power BI中集成API和JSON数据后将数据转换为表?

在Jenkins中使用ReadJSON读取json子元素

Bash和echo命令出现意外结果

Vega Lite中的图例对齐

如何将响应数据保存到Flutter 中的共享首选项中

解析Ansible AWS ec2_security_group中的json以提取安全组ID

当列为空时从 SQL 获取 JSON

如何使用jolt规范将一个对象添加到另一个对象中并删除该对象

添加到数组时出错:找不到Add的重载和参数计数:1

Jackson Json:如何将数组转换为 JsonNode 和 ObjectNode?

json.decoder.JSONDecodeError:期望值:第 1 行第 1 列(字符 0)

将 PHP 结果数组转换为 JSON

如何使用 LWP 发出 JSON POST 请求?

使用 Node.js 对 JSON 中的字符串大小有限制吗?

jQuery JSON 响应总是触发 ParseError

ASP.NET MVC 读取原始 JSON 发布数据

如何让 javascript 从 .json 文件中读取?

如何在spark 上将json字符串转换为数据帧

通过 JSON 发送 64 位值的公认方式是什么?

js 中奇怪的 JSON 解析行为,Unexpected token :