2025-10-01 12:20:59 +02:00
|
|
|
import json
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
2025-10-03 15:17:44 +02:00
|
|
|
def save_json(dictionary: dict, path: Path):
|
2025-10-01 12:20:59 +02:00
|
|
|
|
2025-10-03 15:17:44 +02:00
|
|
|
json_string = json.dumps(dictionary)
|
2025-10-01 12:20:59 +02:00
|
|
|
FILE = open(path, "w")
|
|
|
|
|
FILE.write(json_string)
|
|
|
|
|
FILE.close()
|
|
|
|
|
|
|
|
|
|
|
2025-10-03 15:17:44 +02:00
|
|
|
def load_json(path: Path) -> dict:
|
2025-10-01 12:20:59 +02:00
|
|
|
FILE = open(path, "r")
|
|
|
|
|
json_string = FILE.read()
|
|
|
|
|
FILE.close()
|
|
|
|
|
|
|
|
|
|
return json.loads(json_string)
|