Nested and List Outputs
Nesting
Part of: Structured Outputs
One field is easy. The real world is shaped like a tree: an invoice has a customer, and that customer has an address, and the invoice has many line items, each with a name, quantity, and price. The moment your output needs lists of objects and objects inside objects , a flat schema stops being enough, and the new failure modes are about depth , not just keys. What it is A nested output is structured data where values are themselves structures: an object whose value is another object, or a key whose value is a list (array) of objects . JSON expresses this naturally with {} for objects and [] for arrays, and they nest freely. The two shapes you reach for constantly: a list of objects (many repeated records, like line items or search results) and a nested object (one structured value inside another, like an address inside a customer). How it works You design and consume nesting with the same discipline as flat fields, applied at each level: 1. Define the shape at every level. The outer object has keys; a list key holds items; each item is its own little schema with its own types. 2. The model fills the whole tree. It returns the full nested structure in one response, arrays and sub-ob
Challenge: Total the Nested Invoice