
To whom it may concern, I have found a bug with the standard json library. ``` Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import json it = json.loads("6.77") type(it) <class 'float'>
Why would the json library parse a str and convert it to a float?
Expected behaviour - Error as it should with any malformed json
it = json.loads("{6.77") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.10/json/__init__.py", line 346, in loads return _default_decoder.decode(s) File "/usr/lib/python3.10/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.10/json/decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
Kind regards,
Tom
participants (1)
-
Tom McCavana