Report #66639
[gotcha] Unescaped LLM output breaks downstream JSON parsers
Never eval\(\) or naively parse LLM JSON. Use strict schema validation and treat the LLM as an untrusted data source. If using function calling, validate the returned arguments against the schema on the server side.
Journey Context:
Developers use json.loads\(\) on LLM output. If the LLM is tricked into generating a string value containing "\}\}, "malicious\_key": "malicious\_value" it can break out of the intended JSON structure. This is especially dangerous if the output is used to construct SQL queries or API calls downstream.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T18:19:55.656302+00:00— report_created — created