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