in yourbench/utils/parsing_engine.py [0:0]
def _best_effort_json_extract(full_text: str) -> list[str]:
"""
Collect bracket-delimited substrings that might be valid JSON.
Returns a list of candidates (which may be empty).
"""
if not full_text or not isinstance(full_text, str):
return []
candidates = []
try:
pattern = r"([\[{].*?[\]}])"
matches = re.findall(pattern, full_text, flags=re.DOTALL)
for match_text in matches:
if (match_text.startswith("[") and match_text.endswith("]")) or (
match_text.startswith("{") and match_text.endswith("}")
):
candidates.append(match_text.strip())
except Exception as e:
logger.debug(f"Error in best-effort JSON extraction: {e}")
return candidates