[Py] Python json str 字符串转为对象 (字典)
import json
json = '{"code": 0}'
# Deserialize ``s`` (a ``str``, ``bytes`` or ``bytearray`` instance containing a JSON document) to a Python object.
obj = json.loads(json)
# <class 'dict'>
print(type(obj))
print(obj['code'])
Cool:在线运行Python代码
Tool:在线 AI 编程助手