parseJSON bug

bearophile bearophileHUGS at lycos.com
Thu Aug 8 05:54:06 PDT 2013


Tofu Ninja:

> I don't think this is a bug, the json spec seems to indicate 
> that this is valid.


The JSON decode of the Python2.6.6 standard library seems to 
refuse it:

>>> import json
>>> json.loads("1.000")
1.0
>>> json.loads("1                                  .000")
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "...\Python26\lib\json\__init__.py", line 307, in loads
     return _default_decoder.decode(s)
   File "...\Python26\lib\json\decoder.py", line 322, in decode
     raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 1 column 35 - line 1 column 39 (char 
35 - 39)


Bye,
bearophile


More information about the Digitalmars-d mailing list