Created
July 17, 2019 10:08
-
-
Save HerrSpace/404b0b5588acbb670dc74cdc24f2b41d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [7]: zz={1:2, '1':'2'} | |
In [8]: zz | |
Out[8]: {1: 2, '1': '2'} | |
In [9]: json.dumps(zz) | |
Out[9]: '{"1": 2, "1": "2"}' | |
In [11]: qq=json.loads(json.dumps(zz)) | |
In [12]: qq | |
Out[12]: {'1': '2'} |
Yeah, an exception would be appropriate when doing json.dumps(zz)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I understand the limitations of JSON perfectly well, yet I think:
The names within an object SHOULD be unique.
https://tools.ietf.org/html/rfc7159#section-4__str__
you will get..TypeError: keys must be a string
. So it does the exact opposite. kthxTelling people to write their complex software carefully is about as sane as telling them to drive their tank carefully. This stuff is complicated.