WeldingSpotPerformance/utils/json_tools.py

12 lines
274 B
Python

from os import path
import json
def read_json(filepath: str) -> dict:
if not path.exists(filepath):
raise FileNotFoundError(f"JSON file {filepath} not found!")
with open(filepath, 'r') as json_file:
data = json.load(json_file)
return data