JSON syntax error: 'unexpected number' or 'JSON.parse: expected ',' or '}' after property value in object'
A number can't start with a not significative 0
.
This is invalid : "ti": 0000011410
From JSON.org :
You should fix it at the source but if you can't, assuming your JSON is always similar to this one (no numbers in strings), then you might probably fix it with a regex :
var obj = JSON.parse(str.replace(/ 0+(?![\. }])/g, ' '));
You can't even here use the evil eval
because "0000011410"
would be parsed as a octal :
console.log(eval('({"ti": 0000011410})'));
outputs
{ti: 4872}
This probably explains why it was considered safer to forbid numbers starting with non significative 0
in JSON.