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を送信しています。

-有効なのは、文字列内の場合、数値の直前の場合、eまたはE浮動小数点数の直後の場合のみです。

それに加えて、コンマは名前/値のペアと配列要素を区切る必要があり、それらの後に続くべきではありません。各オブジェクト/配列の最後のエントリに続くコンマも無効です。

于 2012-04-13T21:18:16.187 に答える