#1 bug when reading empty array nested inside object

open
nobody
None
5
2005-08-07
2005-08-07
Anonymous
No

an exception is incorrectly raised when an empty array
is nested inside an object.

>>> import json_old
>>> json_old.read('{"foo": []}')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "json_old.py", line 308, in read
return JsonReader().read(s)
File "json_old.py", line 54, in read
result = self._read()
File "json_old.py", line 63, in _read
return self._readObject()
File "json_old.py", line 229, in _readObject
raise ReadException, "Not a valid JSON object: '%s'
due to: '%s'" % (self._generator.all(), ch)
json_old.ReadException: Not a valid JSON object:
'{"foo": []}' due to: ']'
>>>
>>> import json_new
>>> json_new.read('{"foo": []}')
{'foo': []}
>>>

Discussion

  • bugfix for incorrect read semantics

     
    Attachments
  • Logged In: YES
    user_id=270334

    This problem is fixed in version 3.4.