Python json dumps / loads create whole keys of my dict str

when I serialize and deserialize the python inline structure, I expect the result to be the same as the input

arr2 = [1,2,'3']
arr2_json = json.dumps(arr2)
json.loads(arr2_json)

Out [16]: [1, 2, '3']

BUT, when I try to do this with a dict, I got str keys instead of integer

dict1 = {0: 'object0', '1': 'object2'}
json1 = json.dumps(dict1)
json.loads(json1)

Out [6]: {'0': 'object0', '1': 'object2'}

Notification keys must be [0, '1'], but actually it is ['0', '1']

What is it? My misunderstanding or ussue in python

Python 3

+4
source share

Source: https://habr.com/ru/post/1693467/


All Articles