Varun Vemulapalli

Day 26 of 100 · Phase 3: Large language models

Structured outputs: JSON

2 min readBy Varun Vemulapalli

A friendly paragraph about an invoice is nice for a person. Your accounting system can't do anything with it.

It needs the vendor, amount and due date in fixed fields, every time. That's what structured output is for.

Video explainer · 1:38
Key takeaway

Define a schema, ask the model for JSON that matches it, and validate every result, so AI output can flow into real systems instead of being copied by hand.

Day 26 visual: Structured outputs: JSON
The visual from the original post.

The concept

Structured output: asking the model to reply in a fixed, machine-readable format instead of free text. The most common format is JSON.

JSON (JavaScript Object Notation): a simple text format of "key": value pairs inside curly braces. Readable by people, easy for software to parse.

Schema: the agreed shape of the JSON. Which fields, what type each one is (text, number, date), which are required.

Many model APIs can enforce a schema directly; check your provider's docs for the option.

Walkthrough: accounts payable inbox

The email:
"Hi team, attached is our bill for March cleaning services. Inv# BR-2291. Total comes to $4,350.00, please pay by April 15 2026. Thanks, Maria, BrightClean Facilities"

Step 1: define the schema.

  • vendor_name: text, required
  • invoice_number: text, required
  • amount: number, required
  • currency: text, required
  • due_date: date (YYYY-MM-DD), required

Step 2: prompt.
"Extract these fields from the email. Return only JSON matching the schema. If a field is missing, use null. Don't guess."

Step 3: model output.
{"vendor_name": "BrightClean Facilities", "invoice_number": "BR-2291", "amount": 4350.00, "currency": "USD", "due_date": "2026-04-15"}

Notice: "Inv#" became invoice_number, "$4,350.00" became the number 4350.00, "April 15 2026" became a standard date.

Step 4: validate before anything gets paid.

  • Is it valid JSON with every required field?
  • Is amount a positive number? Is due_date a real date?
  • Is the vendor in the vendor master? Does the amount match the PO?
  • Anything that fails or comes back null goes to a person.

Why apps need this: free text changes wording every time. A fixed schema lets the next system (ERP, workflow, database) use the result without retyping.

Where you see it at work

  • Banking: pulling key terms from loan documents into fields for review.
  • Insurance: turning a first notice of loss email into a claim record.
  • Healthcare: extracting referral details (patient ID, reason, urgency) into a queue, with staff verification.
  • Business analysis: the schema is a data contract. Define fields, types and rules with the downstream team first.

In one sentence

Define a schema, ask the model for JSON that matches it, and validate every result, so AI output can flow into real systems instead of being copied by hand.

Your turn: which document at work do people still retype field by field into another system? 👇

Join the discussion on LinkedIn