llm_learn/蒸馏/数据集/问题/源文件/alpaca-chinese-dataset-main/utils/json_util.py
2025-10-16 08:46:13 +08:00

16 lines
358 B
Python

import json
class JsonUtil:
@staticmethod
def read_file(path):
with open(path, 'r', encoding='utf-8') as rf:
data = json.load(rf)
return data
@staticmethod
def save_file(path, data):
with open(path, 'w', encoding='utf-8') as wf:
wf.write(json.dumps(data, ensure_ascii=False, indent=4))