There is the problem in the current py3k version of json. b"hi" can be
serialized, but not [b"hi"].
>>> json.dumps(b"hi")
'"hi"'
>>> json.dumps([b"hi"])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/antoine/py3k/__svn__/Lib/json/__init__.py", line 230, in dumps
return _default_encoder.encode(obj)
File "/home/antoine/py3k/__svn__/Lib/json/encoder.py", line 367, in encode
chunks = list(self.iterencode(o))
File "/home/antoine/py3k/__svn__/Lib/json/encoder.py", line 306, in
_iterencode
for chunk in self._iterencode_list(o, markers):
File "/home/antoine/py3k/__svn__/Lib/json/encoder.py", line 204, in
_iterencode_list
for chunk in self._iterencode(value, markers):
File "/home/antoine/py3k/__svn__/Lib/json/encoder.py", line 317, in
_iterencode
for chunk in self._iterencode_default(o, markers):
File "/home/antoine/py3k/__svn__/Lib/json/encoder.py", line 323, in
_iterencode_default
newobj = self.default(o)
File "/home/antoine/py3k/__svn__/Lib/json/encoder.py", line 344, in
default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: b'hi' is not JSON serializable