Structured output (JSON, simply)

Intermediate · 6 min · Request output shaped for reuse — a named table, fixed fields or JSON — with no extra commentary.

  • prompting
  • structured output

Structured output is output shaped for a destination — a spreadsheet column, a checklist, a field list your tool can read. Most AI answers are written for a human reader: fluent prose you have to re-type before it is useful. Asking for a fixed shape changes that. And you do not need to be a programmer: you need to name the shape.

Three levels of shape

  1. A table or list — for humans and spreadsheets. “A markdown table with columns: Vendor, Due date, Amount.”
  2. Fixed fields — for partial reuse. “For each item, output three lines: Name:, Deadline:, Owner:.”
  3. JSON — for tools. “A JSON array where each object has the keys invoice, due, amount.” JSON is just labeled data; the keys are the labels.

The recipe

A bad example

Ask: “Summarize these invoices in a clear, organized way.”

Clear to whom? You get elegant prose — and an afternoon of re-typing it into a sheet.

A better example

Ask: “Here are three invoices: [paste]. Extract one row per invoice into a markdown table with columns: Vendor, Invoice number, Due date, Amount. Use ‘not found’ when a field is missing. Output only the table.”

Now the answer pastes into a spreadsheet, and every gap is visible instead of invented.

Test the shape before you run it

Ask for the first two rows only and check the shape. Fixing a column name costs one follow-up; re-deriving two hundred rows costs the afternoon. When you do get JSON, confirm it actually parses before trusting it downstream — chat interfaces often add a friendly sentence or wrap long lines, which breaks importers silently. The shape is a promise the model usually keeps, but you are still the one who checks.

Why it works

Models are pattern machines: a named shape plus one example row is the strongest pattern signal you can give, and it leaves nothing to improvise. Free-form requests leave the structure to chance; fixed fields leave it to you.

Practice

Assemble a structured-output prompt

A teammate needs the three supplier invoices on their desk turned into rows — vendor, invoice number, due date and amount — ready to paste into a budget spreadsheet.

Fill every field to assemble a prompt that asks for a clean table instead of prose. The preview shows exactly what you would send; then compare it with a strong example.

Your prompt, assembled

 
Hint

A column list is a format; 'organized' is a hope.

What happens to a due date the invoice never mentions? Decide before the model does.

Transfer

Next

Next: Iterate from the output — the first draft is a draft; here is how to steer it without starting over.