20 lines
402 B
Python
20 lines
402 B
Python
import json
|
|
from pathlib import Path
|
|
|
|
|
|
def load_json_template(template_path):
|
|
with open(template_path, 'r') as f:
|
|
return json.load(f)
|
|
|
|
|
|
def save_json(data, file_path):
|
|
with open(file_path, 'w') as f:
|
|
json.dump(data, f, indent=4)
|
|
|
|
|
|
def ensure_directory_exists(path):
|
|
path = Path(path)
|
|
if not path.exists():
|
|
path.mkdir(parents=True, exist_ok=True)
|
|
return path
|