I have a problem with a piece of JSON containing a float number of 0000000000000000E+00 (essentially zero). Consider, for example:
{
"a": 3199999999999999E+01,
"b": 0000000000000000E+00,
"c": 0,
"d": 5
}
The zero floating point number gives an error under the following circumstances:
- Running it through JSONLint (http://jsonlint.com/)
- Evaluating it in the
browser on Windows with jQuery.parseJSON (IE and Firefox, various
versions of jQuery
Changing the zero floating point number to any non-zero value gives no hassles.
Look also at the following JSFiddle: http://jsfiddle.net/Gr6fq/. When I run this in Linux, it works. On Windows, it gives an error.
It looks like the Javascript parser interprets the leftmost leading zero as the octal modifier, and proceeds to parse the current token as an octal number. It then chokes on the
Etoken it encounters afterwards.Using Firefox 5.0’s console: