MCPcopy Create free account
hub / github.com/NatsUIJM/autoContents / read_json_file

Function read_json_file

mainprogress/content_postprocessor.py:28–34  ·  view source on GitHub ↗

读取 JSON 文件并返回数据,统一返回列表格式

(file_path: Path)

Source from the content-addressed store, hash-verified

26
27
28def read_json_file(file_path: Path) -> list:
29 """读取 JSON 文件并返回数据,统一返回列表格式"""
30 with open(file_path, 'r', encoding='utf-8') as f:
31 data = json.load(f)
32 if isinstance(data, dict) and "items" in data:
33 return data["items"]
34 return data
35
36
37def extract_book_title(filename: str) -> str:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected