我能否在以下发言中发表一些意见?Json Json (Json Json) (Json Json Json) (Json Json) Json Json (Json Json) Json (Json) Json (Json) Json (Json) Json (Json) Json (Json) Json (Json) Json(Json) Json (Json) Json (Json) Json(Json) Json (Json) Json如果有,如何处理?


当前回答

这是我在Google 火底文件允许你对JSON发表评论:

{
  "//": "Some browsers will use this to enable push notifications.",
  "//": "It is the same for all projects, this is not your project's sender ID",
  "gcm_sender_id": "1234567890"
}

其他回答

JSON并不支持本地的评论, 但您可以自己制作解码器或至少预处理器来删除评论, 这完全没问题(只要您只是忽略评论, 不使用它们来指导您的应用程序如何处理 JSON 数据 ) 。

JSON没有评论。 JSON 编码器必须输入输出评论。 JSON 编码器可能接受和忽略评论。

评论绝不应被用来传递任何有意义的信息。这就是JSON的目的。

参 :Douglas Crockford,Json Spec的作者,道格拉斯·克罗克福德.

我喜欢 @eli ' s 方法, 超过 30 个答案, 但没有人提到列表( array) 。 所以使用 @eli ' s 方法, 我们可以做一些类似的事情:

"part_of_speech": {
  "__comment": [
    "@param {String} type - the following types can be used: ",
      "NOUN, VERB, ADVERB, ADJECTIVE, PRONOUN, PREPOSITION",
      "CONJUNCTION, INTERJECTION, NUMERAL, PARTICLE, PHRASE",
    "@param {String} type_free_form - is optional, can be empty string",
    "@param {String} description - is optional, can be empty string",
    "@param {String} source - is optional, can be empty string"
  ],
  "type": "NOUN",
  "type_free_form": "noun",
  "description": "",
  "source": "https://google.com",
  "noun_class": {
    "__comment": [
      "@param {String} noun_class - the following types can be used: ",
        "1_class, 2_class, 3_class, 4_class, 5_class, 6_class"
    ],
    "noun_class": "4_class"
  }
}

考虑使用雅姆勒它几乎是JSON的超集(几乎所有有效的JSON都是有效的YAML),它允许评论。

JSON和JSON需要提出评论。至少可在.NET Core 中提供评论。JSON和牛顿软JSON 工作很顺利

{
  // this is a comment for those who is ok with being different
  "regular-json": "stuff"...
}

Dojo工具包 JavaScript工具包(至少是1.4版)允许您在 JSON 中加入评论。/* */Dojo 工具包使用JSONdojo.xhrGet()拨打。

其他JavaScript工具箱也可能同样发挥作用。

在选择最后选择之前先试验其他数据结构(甚至数据清单)时,这样做会有帮助。