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.
Don't re-roll the whole response — send back a surgical prompt that fixes the violations and keeps everything that was right.
When output breaks the rules, the reflex is to regenerate — and lose everything that was correct in the re-roll. The repair prompt is the better move: it restates the original requirement, lists each violation with its specific fix, and instructs the model to return only the corrected output, changing nothing else. This setup demonstrates it on a classification that invented a label ("Very Urgent") outside the defined set — one of the violations where a surgical fix beats a fresh attempt.
Validate first
The repair prompt is generated from real findings — no findings, no repair, no busywork.
Send it in the same thread
The model repairs its own response best when that response is still in context.
Re-validate the repair
Paste the corrected output back in — PASS closes the loop; anything else gets a fresh repair prompt.
The OUTPUT RULES pin it down: "Fix only the problems listed above — do not change anything else" and "Keep everything that was already correct unchanged." In this example only the invalid "Very Urgent" label is flagged, so your assistant returns the corrected classification against the defined set and leaves the rest untouched — a surgical edit, not a re-roll.
The AI Output Validator generates the repair prompt from real findings, so no violations means no repair. You send it in the same thread where the model's response is still warm, then paste the corrected output back into the validator — a PASS closes the loop, anything else gets a fresh repair prompt. NewPrompt never runs or confirms the fix.
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.
The draft is 90% right and you ask AI to fix the one thing that's wrong — and it hands back a whole new version with the good parts rewritten worse. Here's how to ask for a targeted edit that fixes what's broken and leaves the rest exactly as it was.
AI review comes back as six scattered notes — some vague, some contradictory, one that would wreck the part you liked. Here's how to triage it into a prioritized revision checklist: accept, reject, or defer each note, protect what must stay, and set the order before you edit.