I’m working with an API that is sending JSON responses like this:
[
- {
"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",
},
},
]
I couldn’t find that minus ‘-‘ sign in any specification documents. Is this JSON standard?
No, it’s not. The server is sending you broken JSON.
The only times
-is valid are when it’s in a string, when it immediately precedes a number, or when it immediately follows theeorEin a floating-point number.Add to that, commas should separate name/value pairs and array elements, not follow them. Those commas following the last entry in each object / array, are invalid as well.