Check the shape of a nested record

Use the opposite Shift key for paired punctuation. · 157 words

Structured output is also about where values live inside a source object. A library catalog source is: {"catalog":{"title":"Maps for Walkers","author":{"name":"Rina Cole"},"details":{"pages":192,"format":null}},"copies":{"available":2}}. The prompt requires a flat object with exactly title, author_name, pages, format, and copies_available. It names the paths: catalog.title, catalog.author.name, catalog.details.pages, catalog.details.format, and copies.available. It also says null is allowed for format, but a missing required value must produce an error object rather than invented data.

The worked result is {"title":"Maps for Walkers","author_name":"Rina Cole","pages":192,"format":null,"copies_available":2}. This is easy to check: compare keys and values, confirm pages and copies_available are numbers, and confirm format stays null instead of becoming an empty string or "unknown". A strong prompt shows the required schema, gives one source example, and states the missing-value policy. These details tell the model how to reshape nested data and when not to fill gaps. If the application needs another shape, change the schema and path list together; changing only the example can leave the contract unclear.

Check your recall

Which nested paths fill author_name and copies_available, and how should a missing format be represented?

Check your answer

author_name comes from catalog.author.name, and copies_available comes from copies.available. A missing optional format should be null, not an empty string or an invented value.

Sources and credits

Original KeyTouch lesson. Background reading · JSON Schema · Understanding JSON Schema.