[issue34972] json dump silently converts int keys to string

Facundo Batista report at bugs.python.org
Mon Feb 3 09:42:30 EST 2020


Facundo Batista <facundo at taniquetil.com.ar> added the comment:

I understand (and agree with) the merits of automatically converting the int to str when dumping to a string.

However, this result really surprised me:

>>> json.dumps({1:2, "1":3})
'{"1": 2, "1": 3}'

Is it a valid JSON?

----------
nosy: +facundobatista

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34972>
_______________________________________


More information about the Python-bugs-list mailing list