2025-10-01 12:20:59 +02:00

19 lines
367 B
Python

import json
from pathlib import Path
def save_json(vocabulary: dict, path: Path):
json_string = json.dumps(vocabulary)
FILE = open(path, "w")
FILE.write(json_string)
FILE.close()
def load_json(path: Path) -> dict[tuple[int, int], int]:
FILE = open(path, "r")
json_string = FILE.read()
FILE.close()
return json.loads(json_string)