parseJSON bug
David
d at dav1d.de
Thu Aug 8 06:14:29 PDT 2013
Am 08.08.2013 14:54, schrieb bearophile:
> 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
JSON.parse("1 .000")
SyntaxError: Unexpected token .
If we follow an existing implementation, we should follow JavaScript
More information about the Digitalmars-d
mailing list