1234567891011121314151617181920 |
- # utils/jsonUtil.py
- import json
- class JsonUtil:
- @staticmethod
- def load_json(file_path):
- with open(file_path, 'r') as file:
- return json.load(file)
- @staticmethod
- def dump_json(data, file_path):
- with open(file_path, 'w') as file:
- json.dump(data, file)
-
- @staticmethod
- def read_json(file_path):
- """读取JSON文件内容"""
- with open(file_path, 'r', encoding='utf-8') as f:
- return json.load(f)
|