Fix Invalid JSON from AI
The JSON won't parse and you can't see why. Deterministic cause-sniffing — trailing commas, single quotes, unclosed brackets — and the repair prompt that fixes it.
Did the summary keep its contract? Section presence, preamble detection, and the "Here is the summary" tax — checked and repaired.
Summary contracts break quietly: a chatty preamble sneaks in, a required section vanishes, and the reader doesn't notice until they need the missing part. This setup validates an executive summary against its three-section contract and catches both classics — the "Here is the summary you asked for:" preamble and a missing What Happens Next section. The repair prompt restores the section (with the honest-fallback instruction to write "Not covered in the source" rather than invent content) and strips the preamble.
List the contract sections in order
The same section names your summary prompt defines — presence and order both get checked.
Watch the preamble detection
"Here is the summary…" is flagged with the offending text quoted — the politeness tax made visible.
Repair with the honesty rule
The repair for a missing section includes "write Not covered in the source if there is nothing to put in it" — the fix can't become an invention.
It checks structure, not truth. It validates the summary against its three-section contract (Summary, Why It Matters, What Happens Next), catching a missing section and a chatty preamble, but checking factual fidelity needs the source, which the validator doesn't see. For that the resource sends you elsewhere; here the win is contract compliance, and you still own the accuracy review.
It's built not to. The repair for the missing What Happens Next section carries an honest-fallback instruction: write "Not covered in the source" if there's nothing to put in it, so the fix can't become fabrication. The repair prompt also strips the "Here is the summary you asked for:" preamble and returns only the corrected output, keeping everything already correct unchanged.
The JSON won't parse and you can't see why. Deterministic cause-sniffing — trailing commas, single quotes, unclosed brackets — and the repair prompt that fixes it.
Paste the response, get the verdict: real JSON parsing, missing-field detection, and a repair prompt for everything found.
Grade agent output the same way every time — a rubric scoring correctness, grounding, safety, tone, and completeness, with a pass threshold instead of a gut call.
Stop getting 'Sure, here is the JSON…' — the output-contract pattern that forces models to return only parseable JSON: schema, example, and a strict rule block.
Free text in, named fields out. The extraction prompt pattern that turns any unstructured text into consistent, parseable records.
Billing, Technical, Account, How-To, Feature Request — ticket triage with definitions that decide the borderline cases for the model.
Paste an AI's output and validate it against the expected format — with a repair prompt for every failure found.