Closed
Description
Bug report
When json encounters a integer as a key of a dictionaries, it converts it to the string representation of that int, which can cause problems.
import json
a = json.dumps({1:'a'})
b = json.loads(a)
b
{'1': 'a'}
b[1]
Traceback (most recent call last):
File "", line 1, in
KeyError: 1
Your environment
-
CPython versions tested on:
python 3.10.4 -
Operating system and architecture:
ubuntu x86-64
GCC 9.4.0
Metadata
Metadata
Assignees
Projects
Status
Done