[issue21092] json serializer implicitly stringifies non-string keys

Berker Peksag report at bugs.python.org
Sat Mar 29 14:34:14 CET 2014


Berker Peksag added the comment:

> This implicit stringification of non-string dictionary keys does not
> currently appear to be documented.

I think this is part of the JSON spec. See http://json.org/object.gif for example.

Also, this is already documented in the json.dumps() documentation:

> Keys in key/value pairs of JSON are always of the type str. When a
> dictionary is converted into JSON, all the keys of the dictionary are
> coerced to strings.

http://docs.python.org/3.4/library/json.html#json.dumps

----------
nosy: +berker.peksag

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


More information about the Python-bugs-list mailing list