wangzhibo
2025-07-30 447abd69ea6002cdd57973420dd8f6655037a601
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# file: utils_file.py
import json
import os
 
 
def load_json(filepath):
    if not os.path.exists(filepath):
        return None
    with open(filepath, 'r', encoding='utf-8') as f:
        return json.load(f)
 
def save_json(data, filepath):
    with open(filepath, 'w', encoding='utf-8') as f:
        json.dump(data, f, ensure_ascii=False, indent=2)