3

我正在使用一个发送 JSON 响应的 API,如下所示:

    [
  - {
    "id": 46843639,
    "nickname": "JSON",
    "registration_date": "2004-03-07T23:16:20.000-04:00",
    "country_id": "BR",
    "user_type": "normal",
    "logo": null,
    "points": 91,
    "site_id": "JSN",
    "permalink": "http://xxxxxx",
    "seller_reputation": - {
      "level_id": "2_orange",
      "power_seller_status": null,
      "transactions": - {
        "period": "historic",
        "total": 14,
        "completed": 8,
        "canceled": 6,
        "ratings": - {
          "positive": 1,
          "negative": 0,
          "neutral": 0,
        },
      },
    },
    "status": - {
      "site_status": "active",
    },
  },
]

我在任何规范文档中都找不到减号“-”。这是 JSON 标准吗?

4

1 回答 1

6

不,这不对。服务器正在向您发送损坏的 JSON。

唯一-有效的时间是它位于字符串中、紧接在数字之前或紧跟在浮点数中的eor之后。E

除此之外,逗号应该分隔名称/值对和数组元素,而不是跟随它们。每个对象/数组中最后一个条目后面的逗号也是无效的。

于 2012-04-13T21:18:16.187 回答