我正在使用一个API发送JSON响应,如下所示:
[
- {
"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标准吗?
发布于 2012-04-13 21:18:16
不,不是的。服务器正在向您发送损坏的JSON。
只有当-
在字符串中、紧跟在数字之前或者紧跟在浮点数的e
或E
之后时,它才是有效的。
除此之外,逗号应该分隔名称/值对和数组元素,而不是跟在它们后面。每个对象/数组中最后一项后面的逗号也是无效的。
https://stackoverflow.com/questions/10148423
复制