[New-bugs-announce] [issue16009] Json not handling errors correctly

Luka Rahne report at bugs.python.org
Sun Sep 23 19:14:25 CEST 2012


New submission from Luka Rahne:

Example:

import json
j = json.loads(
"""
{
    "phoneNumber": [
        {
            "type": "home",
            "number": "212 555-1234"
        },
}

""")
print(j)

Output>>
Traceback (most recent call last):
  File "<stdin>", line 13, in <module>
  File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded


My comment:
It is annoying in case of manual json editing where you can't know where jeson typeing error is.

----------
components: Library (Lib)
messages: 171062
nosy: Luka.Rahne
priority: normal
severity: normal
status: open
title: Json not handling errors correctly
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16009>
_______________________________________


More information about the New-bugs-announce mailing list