MCPcopy Create free account
hub / github.com/OpenDCAI/Paper2Any / _parse_json_lines

Function _parse_json_lines

dataflow_agent/utils_common.py:172–183  ·  view source on GitHub ↗
(src: str)

Source from the content-addressed store, hash-verified

170
171# ---------------- JSON Lines ----------------
172def _parse_json_lines(src: str) -> Union[List[Any], None]:
173 lines = [ln.strip() for ln in src.splitlines() if ln.strip()]
174 if len(lines) <= 1: # 只有 0/1 行就不是 jsonl
175 return None
176
177 objs: List[Any] = []
178 for ln in lines:
179 try:
180 objs.append(json.loads(ln))
181 except JSONDecodeError:
182 return None # 某行不是合法 JSON,放弃 jsonl 方案
183 return objs
184
185
186# ------------ 多对象提取(改进版) ------------

Callers 1

robust_parse_jsonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected