beginnerStructured Output
What's a risk of structured output that doesn't exist with plain text chat responses?
The model can still occasionally return malformed JSON, extra prose around the JSON, or a schema that's close-but-not-quite what you asked for, so code parsing the response needs defensive handling (retry with a stricter prompt, or a repair step) rather than assuming the parse will always succeed.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response