[issue6566] json.dumps converts None to "null" (not null)

Merlijn van Deen report at bugs.python.org
Sat Mar 17 17:37:47 CET 2012

Merlijn van Deen <valhallasw at gmail.com> added the comment:

JSON does not have the distinction between bytes and unicode; py2 strings are coerced into unicode.

I think it would be better to speak about 'JSON string' or 'JSON string element' if it's JSON and about 'unicode' (2.7) or 'str' (3.x) when speaking about the data that has been decoded again.

>>> json.loads(json.dumps("boo"))
>>> json.loads(json.dumps({"a": "b"}))
{u'a': u'b'}

(the keys will always be unicode in 2.7)

nosy: +valhallasw

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list