Skip to content
CCA-F
Prompt Engineering & Structured Output
hard
Question 2 of 38

A developer instructs Claude in the system prompt to "always return valid JSON with the following fields." At a volume of 10,000 requests per day, the pipeline occasionally receives malformed JSON (roughly 1% of responses). What is the most production-appropriate fix?

AImprove the prompt instructions with more explicit JSON formatting rules and add more examples
BImplement a three-layer pipeline: tool_use schema for structural enforcement, programmatic semantic validation, and a retry loop that sends validation errors back to Claude for correction
CSwitch to a newer, larger Claude model that follows format instructions more reliably
DWrap the JSON parser in a try-except block and substitute a default empty object on parsing failures

Educational Content — CertQnA practice questions are written against official exam objectives, covering the same domains tested on the real exam. All content is original and independent — not actual exam questions, not affiliated with any certification vendor. Learn more about our content policy

Discussion

Be the first to share your understanding of this concept

⚠️ Discussion is for concept clarification only. Do not share or request actual exam questions or answers.

Sign in to join the discussion