import json
if os.path.isfile(filename):
with open(filename) as myfile:
file_content = myfile.read()
try:
json_content = json.loads(file_content)
except json.decoder.JSONDecodeError:
# Cannot read the file
json_content = None
Read JSON file
Read JSON file and store it as a dictionary
Shortcut: json.file.read
0 Comments
Add Comment
Log in to add a comment