MCPcopy Create free account
hub / github.com/FastMAS/KVCOMM / JSONReader

Class JSONReader

KVCOMM/tools/reader/readers.py:56–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 return text
55
56class JSONReader(Reader):
57 def parse_file(file_path: Path) -> list:
58 logger.info(f"Reading JSON file from {file_path}.")
59 try:
60 with open(file_path, "r") as f:
61 data = json.load(f)
62
63 return data
64 except:
65 return []
66
67 def parse(self, file_path: Path) -> str:
68 logger.info(f"Reading JSON file from {file_path}.")
69 try:
70 with open(file_path, "r") as f:
71 data = json.load(f)
72 text = str(data)
73 return text
74 except:
75 return ''
76
77class JSONLReader(Reader):
78 def parse_file(file_path: Path) -> list:

Callers 1

readers.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected