LearnFrenzy
Sign in Take a free test

Core Techniques · Lesson 4 of 5

Structured Output: Getting Tables, JSON and Clean Formats from AI

Ask for structure and you get answers you can paste straight into Excel, code or a slide. Delimiters, tables, JSON and the mistakes that break them.

9 min read Intermediate Updated Nov 5, 2026 Reviewed by Saurabh Samir

An AI answer that reads nicely is fine for learning. But when you need to use the output — paste it into a spreadsheet, feed it to a program, put it on a slide — you need structure.

Separate your instructions from your data

When you paste text for the AI to work on, mark clearly where it starts and ends. Use triple quotes, a line of dashes, or XML-style tags:

Summarise the meeting notes inside the <notes> tags into
three action items, each with an owner and a deadline.

<notes>
[paste notes here]
</notes>

Without clear boundaries, the model can confuse your instructions with the text you pasted — especially if that text itself contains instructions or questions.

Tables: great for comparisons

Compare Python lists, tuples, sets and dictionaries in a table with
these columns: Ordered?, Mutable?, Allows duplicates?, Typical use,
One-line example. No text outside the table.

Naming the exact columns gives you consistent output, and "No text outside the table" removes the usual chatty introduction.

JSON: when a program will read the output

Extract details from this job posting and reply with JSON only,
using exactly these keys:

{
  "role": string,
  "company": string,
  "location": string,
  "experience_years": number or null,
  "skills": [string]
}

If a value is not in the text, use null. Do not add extra keys.

Job posting:
"""
[paste here]
"""

Three rules for reliable JSON: show the exact keys and types, say what to do when data is missing (use null), and ask for JSON only — no explanation before or after.

Common mistakes

  • Asking for "a table" but not naming columns — every run comes out different.
  • Not saying what to do with missing information — the model fills gaps with guesses.
  • Trusting JSON without validating it — in real code, always parse and check it; if parsing fails, ask the model to fix it.
  • Mixing two tasks in one structured request — split them into two prompts.

Other useful structures

  • Checklists — "Give me a pre-interview checklist with checkboxes".
  • CSV — easy to open in Excel or Google Sheets.
  • Markdown headings — for notes you will keep in Notion or Obsidian.
  • Fixed templates — paste a template with blanks and ask the AI to fill only the blanks.

Try it yourself: Copy three job postings from a job portal. Use the JSON prompt above to extract them, paste the results into an online JSON validator, then compare the skills each company wants. You have just built a mini job-research tool.

Common interview questions

Try answering each one aloud before you open it.

1How do you get reliable structured output from an LLM?

Specify the exact schema (keys and types), give an example, instruct how to handle missing values, request only the structured output, and validate it in code — retrying or repairing on failure.

2Why use delimiters in prompts?

They clearly separate instructions from input data, which reduces confusion and helps protect against instructions hidden inside the pasted content.

Practise this

Build something with it

FAQs

What if the AI adds text before the JSON?

Repeat "Reply with JSON only" at the end of the prompt. In code, use the tool’s structured-output or JSON mode if available.

Can I get Excel-ready output?

Yes — ask for CSV with a header row, then paste it into Excel or Google Sheets.

References & further reading

Finished this lesson?

Mark it complete. Create a free account to save it on every device.

Next lesson

Search LearnFrenzy

Esc

Quick links