MCPcopy Create free account
hub / github.com/KnowledgeXLab/LeanRAG / read_json

Function read_json

tools/io_file.py:234–247  ·  view source on GitHub ↗

读取JSON文件。 参数: - file_path (str): 文件路径。 - encoding (str): 文件编码格式,默认为 'utf-8'。 返回: - dict: 读取的JSON文件内容。

(file_path, encoding='utf-8')

Source from the content-addressed store, hash-verified

232
233
234def read_json(file_path, encoding='utf-8'):
235 """
236 读取JSON文件。
237
238 参数:
239 - file_path (str): 文件路径。
240 - encoding (str): 文件编码格式,默认为 'utf-8'
241
242 返回:
243 - dict: 读取的JSON文件内容。
244 """
245 with open(file_path, 'r', encoding=encoding) as f:
246 logger.info(f"读取JSON文件: {file_path}")
247 return json.load(f)
248
249def read_yaml(file_path, encoding='utf-8'):
250 """

Callers 1

readFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected