import json
# Open the file and read its contents as a string
with open('myjson.json', 'r') as f:
json_string = f.read()
# Load the JSON string into a Python object
json_obj = json.loads(json_string)
# Print the object to verify it was loaded correctly
print(json_obj)
1条答案
按热度按时间t8e9dugd1#
您可以使用'json'模块将json文件作为Python对象进行加载。
将“myjson.json”替换为您自己的json文件名。