一般来讲,JSON 解码会根据提供的数据创建dicts 或lists。如果你想要创建其他类型的对象,可以给json.loads() 传递object_pairs_hook 或object_hook 参数
>>> s='{"name":"apple","shares":50,"prices":490.11}'
>>> s
'{"name":"apple","shares":50,"prices":490.11}'
>>> from collections import OrderedDict
>>> import json
>>> data=json.loads(s,object_pairs_hook=OrderedDict)
>>> data
OrderedDict([('name', 'apple'), ('shares', 50), ('prices', 490.11)])
>>>