MCPcopy Create free account
hub / github.com/Tencent/digitalhuman / extract_json

Function extract_json

SWF/src/utils.py:75–86  ·  view source on GitHub ↗
(content)

Source from the content-addressed store, hash-verified

73 return extracted_texts
74
75def extract_json(content):
76 try:
77 tmp = json.loads(repair_json(content))
78 if isinstance(tmp, dict):
79 return True, tmp
80 elif isinstance(tmp, list):
81 tmp = [e for e in tmp if isinstance(e, dict)]
82 return True, tmp[0]
83 else:
84 return False, content
85 except:
86 return False, content
87
88
89def extract_boxed_answer(solution_string: str) -> list:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected