CCDV-F practice › Prompt & Context Engineering · Question 17 of 92

Prompt & Context Engineering

A pipeline calls a JSON parser directly on model output and crashes whenever the model wraps its JSON in a sentence of prose. What's the fix?

Show answer and explanation

Answer: B — Validate against a schema, handle deviations explicitly, and retry with the error fed back

Defensive parsing assumes the model will occasionally deviate and handles it in code — schema validation plus a feedback retry loop — rather than hoping a politer prompt eliminates the deviation entirely.