xxxxxxxxxx
with open('keys.json', encoding='utf-8') as fh:
data = json.load(fh)
print(data)
# from stackoverflow : https://stackoverflow.com/questions/46408051/python-json-load-set-encoding-to-utf-8
xxxxxxxxxx
with open('config.json', 'r', encoding='utf-8') as fh:
config = json.load(fh)
xxxxxxxxxx
import json
def read_json_file(file_path):
"""
Read and parse a JSON file.
Parameters:
- file_path (str): The path to the JSON file.
Returns:
- dict: The parsed JSON data.
"""
with open(file_path, 'r', encoding='utf-8') as file:
data = json.load(file)
return data