Structured Output is a technique that tells an AI model to respond in a predictable, machine-readable shape — like a Java object — so your code can use the result directly without fragile text parsing.
Picture a Tuesday afternoon. You're wiring up the EngineerPrep lesson-generation pipeline — the system that turns a lesson plan into a finished, published lesson. You ask Claude to produce the lesson metadata: a title, an estimated reading time, and a list of topic tags. Claude is helpful. It writes back a nice sentence. "The title is Structured Output , reading time is about 8 minutes, and the tags are: Java, Spring AI, LLMs." You write a small parser. It works on that example. Then tomorrow Claude says: "Here's what I came up with — title: Structured Output , tags: Java, Spring AI, LLMs, and I'd estimate roughly 8 minutes of reading." Same information. Different word order. Your parser returns null for reading time. This is the problem Structured Output solves. The question the lesson answers is simple: how do you make an AI respond with a shape your code can rely on?
Think about ordering a coffee. If you just say "give me something warm," the barista has total freedom — espresso, tea, hot chocolate, whatever. But if you hand them a form with boxes labelled "size", "drink type", and "milk option", they fill in exactly those boxes and hand it back. You don't have to read a paragraph to find out what you ordered. Structured Output is that form. Instead of letting the model write a free-form paragraph, you give it a schema — a description of the exact fields you want back. The model fills in those fields. Your code reads them directly, like properties on a Java object. A schema is just a description of a shape: "I want an object with a title field (a string), a readingTimeMinutes field (a number), and a tags field (a list of strings)." When you attach that schema to your request, the model treats it as a contract.…
Imagine the conversation as two boxes connected by a pipe. Box 1 — Your Spring service holds a Java record: record LessonMetadata(String title, int readingTimeMinutes, List<String tags) That record is your form. Step 1 — Spring AI reads the record and builds a schema. It inspects the fields and produces a description: "respond with a JSON object that has title (string), readingTimeMinutes (integer), and tags (array of strings)." You never write this yourself — Spring AI does it. Step 2 — The schema travels to Claude on Bedrock along with your prompt. Claude receives both the instruction ("generate metadata for this lesson") and the form ("put your answer in these exact fields"). The schema steers the model's output toward the specified structure rather than prose. Step 3 — Claude responds with JSON, not a sentence.…