将JSON转换为Python字典(寻找更好的方法)
所以我已经写了这段代码,但感觉一定有更好的方法:将JSON转换为Python字典(寻找更好的方法),json,python-3.x,Json,Python 3.x,所以我已经写了这段代码,但感觉一定有更好的方法: # json_data is a passed in JSON object str_json = str(json_data) # convert the string to python dictionary new_dict = json.loads(str_json) 这是你的朋友 json.loads 这是你应该使用的方法。这是最好的办法 他是你的朋友 json.loads 这是你应该使用的方法。这是最好的办法 哦,所以根本不需要
# json_data is a passed in JSON object
str_json = str(json_data)
# convert the string to python dictionary
new_dict = json.loads(str_json)
这是你的朋友
json.loads
这是你应该使用的方法。这是最好的办法 他是你的朋友
json.loads
这是你应该使用的方法。这是最好的办法 哦,所以根本不需要转换成字符串。很高兴知道!哦,所以根本不需要转换成字符串。很高兴知道!