Ask AI for Tables, Checklists and JSON: Structured Output Made Easy
Generative AI course · Chapter 8 · Estimated reading time: 15 minutes
In the last chapter you made the AI think in steps. Now we control the shape of the answer. A long paragraph is fine for reading, but you cannot paste a paragraph into Excel, tick it off like a list, or send it to an app. In this chapter you will ask for 3 shapes that you can actually use: a table for Excel, a checklist you can tick, and JSON, the format that apps and websites use to pass data. You will build an expense table and check its total, an interview checklist for a fresher, and a JSON record from a WhatsApp enquiry, which we will test with 10 lines of Python. With this chapter you will have the 4 core prompting skills: the 4 parts, examples, steps and shape.
What you will learn in this chapter
- Why the shape of an answer matters
- Ask for a table with fixed columns
- Move an AI table into Excel
- Get CSV for a clean import
- Make a checklist you can tick
- What JSON is, in simple words
- Turn a message into JSON
- Test JSON with Python
1. Suppose we want last week's spending in Excel
Suppose we are Tanvi, a college student in Pune. We wrote last week's spending in our phone notes, in one messy line:
mon auto 60 lunch 90, tue notebook pens 145, wed recharge 349, thu chai samosa 40, fri bus pass 200, sat movie 180
We ask the AI:
Organise my spending: mon auto 60 lunch 90, tue notebook pens 145, wed recharge 349, thu chai samosa 40, fri bus pass 200, sat movie 180
A typical answer (yours will be similar, not the same):
Here is a summary of your spending this week. On Monday you spent ₹60 on an auto and ₹90 on
lunch. On Tuesday you bought a notebook and pens for ₹145. Your biggest expense was the mobile
recharge of ₹349 on Wednesday...
Nice to read, but useless for Excel. Now we tell it the shape:
Turn my spending into a table with exactly these columns: Day, Item, Category, Amount (₹).
Categories: Travel, Food, Study, Bills, Fun.
One row per item. Numbers only in the Amount column, no ₹ sign.
After the table, write the total on one line.
Spending: mon auto 60 lunch 90, tue notebook pens 145, wed recharge 349, thu chai samosa 40, fri bus pass 200, sat movie 180
Expected output:
| Day | Item | Category | Amount (₹) |
|---|---|---|---|
| Monday | Auto | Travel | 60 |
| Monday | Lunch | Food | 90 |
| Tuesday | Notebook and pens | Study | 145 |
| Wednesday | Mobile recharge | Bills | 349 |
| Thursday | Chai and samosa | Food | 40 |
| Friday | Bus pass | Travel | 200 |
| Saturday | Movie | Fun | 180 |
Total: 1064
Same data, same AI. The only change: we said which columns, which categories and what goes in each cell. That is structured output.
2. Three shapes, three uses
| Shape | Looks like | Use it when | You check it with |
|---|---|---|---|
| Table | Rows and columns | You want to compare, sort, total or paste into Excel | Excel formulas like =SUM() |
| Checklist | Items with ☐ boxes | You need to do or check things one by one | Ticking each item in real life |
| JSON | {"name": "Snehal", "course": "AWS"} |
An app, website, form or another program needs the data | A JSON checker or 10 lines of Python |
The golden rule for every shape: name the parts. For a table, name the columns. For a checklist, name the groups. For JSON, name the keys. If you do not name them, the AI chooses, and it chooses differently every time.
3. Worked example 1: the expense table, into Excel and checked
Move the table into Excel
- Run the second prompt from section 1.
- Select the table in the answer (from "Day" to the last number), and copy it.
- Open Excel or Google Sheets, click cell
A1, and paste. - The columns usually land in the right cells. If everything goes into one column, use the CSV way below.
The CSV way (the cleanest import)
CSV means "comma-separated values". Each line is one row, and commas separate the columns. Excel and Google Sheets open it directly.
-
In the same chat, type:
Now give the same data as CSV with the header Date,Item,Category,Amount. Use dates from 2026-10-12 (Monday) to 2026-10-17 (Saturday). Output only the CSV in a code block.
Expected output:
Date,Item,Category,Amount
2026-10-12,Auto to college,Travel,60
2026-10-12,Lunch at canteen,Food,90
2026-10-13,Notebook and pens,Study,145
2026-10-14,Mobile recharge,Bills,349
2026-10-15,Chai and samosa,Food,40
2026-10-16,Bus pass top-up,Travel,200
2026-10-17,Movie ticket,Fun,180
- Copy the CSV lines into a plain text editor (Notepad, or any notes app that saves plain text) and save the file as
expenses.csv. - Open
expenses.csvin Excel, or in Google Sheets use File → Import.
Check the numbers
- With the CSV in Excel, the amounts are in
D2toD8. - In
D9type=SUM(D2:D8). You should see1064, the same as the AI's total. - In
F2typeFoodand inG2type=SUMIF($C$2:$C$8,F2,$D$2:$D$8). You should see130(90 + 40). - Do the same for
Travel(260),Study(145),Bills(349) andFun(180). These 5 add up to1064.
Ravindra Bagale's Tip
Students ask for "a table" and then get a ₹ sign, commas and words like "approx" inside the number cells, so =SUM() gives 0. Say it clearly in the prompt: "numbers only in the Amount column". And always run =SUM() yourself; never copy the AI's total into a report without checking.
4. Worked example 2: an interview checklist for a fresher
Situation: suppose we are Nikhil, a BCA graduate from Solapur. We have an interview for a junior support engineer role at an IT company like Wipro next Monday, at their Pune office. We want a checklist we can tick, so nothing is forgotten.
-
Paste this prompt:
Role: You are a placement officer who prepares freshers for IT job interviews. Task: Make an interview checklist for me. Context: Junior support engineer role, in-person interview in Pune next Monday at 10 am. I travel from Solapur. I know basic networking, Windows and Excel. Format: - 4 groups, in this order: 3 days before, 1 day before, Interview morning, After the interview. - Each group has 4 to 6 items. - Each item starts with "☐ " and is one short line, starting with an action word. - No paragraphs, no extra advice outside the groups.
Expected output (yours will be similar, not the same):
3 days before
☐ Read the job description again and underline 5 key skills
☐ Prepare a 1-minute "Tell me about yourself" answer
☐ Revise basic networking: IP address, DNS, ping
☐ Practise 3 Excel tasks: SUM, VLOOKUP, a simple chart
☐ Book the bus or train from Solapur to Pune
1 day before
☐ Print 2 copies of your resume
☐ Keep your ID proof and certificates in one folder
☐ Iron formal clothes and polish shoes
☐ Check the office address and how long it takes from where you stay
☐ Sleep by 11 pm
Interview morning
☐ Eat a light breakfast
☐ Reach the office by 9:30 am
☐ Switch your phone to silent
☐ Greet the interviewer and smile
After the interview
☐ Note the questions you were asked
☐ Send a short thank-you email the same day
☐ Write down 2 things to improve for the next interview
- Make it yours: copy the checklist into Google Keep, Microsoft To Do or your phone notes. Many notes apps turn lines into tick boxes.
- Follow-up idea:
Add a 5th group: Questions I can ask the interviewer, with 3 items.
Why the prompt worked: we named the groups and their order, the number of items, the start of each line ("☐ " and an action word) and what not to add.
5. What is JSON? (very simple)
JSON is a way to write data so that programs can read it. Websites, apps, forms and AI tools all pass data to each other in JSON.
Here is one enquiry written as JSON:
{
"name": "Snehal",
"course": "AWS",
"mode": "offline",
"wants_fees": true,
"email": null
}
How to read it:
| Part | Meaning |
|---|---|
{ } |
One record (one enquiry) |
"name" |
A key: the name of a field, always in double quotes |
"Snehal" |
A value: text values are in double quotes |
true or false |
A yes/no value, with no quotes |
null |
"Not given", with no quotes |
, |
Separates one key-value pair from the next. No comma after the last one |
That is all you need for now. One missing comma or quote, and a program cannot read the JSON. So we always test it.
6. Worked example 3: a WhatsApp enquiry becomes JSON
Situation: suppose a training institute in Pune gets many WhatsApp enquiries. Someone copies each one into an enquiry form by hand. We will make the AI turn each message into JSON with fixed keys, so it can go into a form or a sheet.
-
Paste this prompt:
Role: You are a data entry assistant for a training institute. Task: Turn the WhatsApp enquiry below into JSON. Use exactly these keys, in this order: name (text), area (text), course (text), mode ("online" or "offline"), batch ("weekday" or "weekend"), wants_fees (true or false), phone (text), email (text). Rules: - Use only facts from the message. If a fact is not in the message, use null. - Do not guess an email or a city. - Output only the JSON in a code block, with no other text. Message: "Hi, I am Snehal from Kothrud. I want to join the AWS course, offline if possible, weekend batch. Please share fees. My number is 98XXXXXX21."
Expected output:
{
"name": "Snehal",
"area": "Kothrud",
"course": "AWS",
"mode": "offline",
"batch": "weekend",
"wants_fees": true,
"phone": "98XXXXXX21",
"email": null
}
Look at "email": null. The message had no email, and the AI did not invent one, because the prompt said "use null". This one rule stops most made-up data.
Ravindra Bagale's Tip
Students ask for JSON without listing the keys, and get "Name" in one answer, "full_name" in the next and "student" in the third. A program expects one exact key. List every key, its type and its allowed values, and say "use null if not given". Then every record has the same shape.
7. Test the JSON with Python
You do not need to be a programmer for this. If you have Python on your computer (or use a free online Python editor), these few lines tell you whether the JSON is valid and whether any key is missing.
- Save the AI's JSON in a file called
enquiry.json. -
In the same folder, save this as
check_enquiry.py:import json text = open("enquiry.json", encoding="utf-8").read() data = json.loads(text) # stops with an error if the JSON is broken required = ["name", "area", "course", "mode", "batch", "wants_fees", "phone", "email"] missing = [key for key in required if key not in data] print("Valid JSON") print("Missing keys:", missing if missing else "none") for key in required: print(f"{key}: {data.get(key)}") -
Run it:
python3 check_enquiry.py(on Windows,python check_enquiry.py).
Output (we ran this exact script on the JSON above):
Valid JSON
Missing keys: none
name: Snehal
area: Kothrud
course: AWS
mode: offline
batch: weekend
wants_fees: True
phone: 98XXXXXX21
email: None
Python shows true as True and null as None. That is normal.
Now break it on purpose. In enquiry.json, delete the comma after "weekend" and run the script again. The last line of the error is:
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 7 column 3 (char 106)
It even tells you the line. Put the comma back, and it is valid again. If the AI ever gives broken JSON, paste the error back into the chat: This JSON gives this error: [paste]. Fix it and output only the JSON.
No Python? Paste the JSON into any trusted JSON validator website, or ask a second AI tool: Is this valid JSON? List any errors. (Do not paste real personal data into unknown websites.)
8. Many records at once: a JSON list
When you have many messages, ask for a list of records. A list goes inside square brackets [ ]:
Turn each of these 3 enquiries into JSON with the same keys and rules as before.
Output one JSON list containing 3 records, and nothing else.
1. "Hello, this is Rahul from Hadapsar. Need Excel online classes, weekdays. Email rahul.k@example.com"
2. "Power BI course details please. Weekend batch. - Neha, Baner"
3. "Is the cyber security course offline? I stay in Wakad. Please send fees. 97XXXXXX45"
Expected output (shortened):
[
{"name": "Rahul", "area": "Hadapsar", "course": "Excel", "mode": "online", "batch": "weekday", "wants_fees": false, "phone": null, "email": "rahul.k@example.com"},
{"name": "Neha", "area": "Baner", "course": "Power BI", "mode": null, "batch": "weekend", "wants_fees": false, "phone": null, "email": null},
{"name": null, "area": "Wakad", "course": "Cyber Security", "mode": "offline", "batch": null, "wants_fees": true, "phone": "97XXXXXX45", "email": null}
]
Check the hard cases yourself: message 3 asks whether the course is offline. Is that "mode": "offline" or null? A careful answer uses null, because the person asked a question; they did not choose. If the AI wrote "offline", add a rule: If the person only asks about a mode, use null. This is the same idea as the hard examples in chapter 6.
9. Structured output prompt patterns (copy and save)
Table:
Make a table with exactly these columns: [Col 1], [Col 2], [Col 3].
One row per [item]. [Rules for cells, e.g. numbers only, no ₹ sign].
After the table, [total / one-line summary / nothing].
Checklist:
Make a checklist in [N] groups, in this order: [Group 1], [Group 2], [Group 3].
Each group has [4 to 6] items. Each item starts with "☐ " and an action word. No paragraphs.
JSON:
Turn [the text] into JSON with exactly these keys: [key (type)], [key (type)], ...
Use only facts from the text. Use null if a fact is missing. Output only the JSON in a code block.
CSV:
Give the data as CSV with the header [A,B,C]. Output only the CSV in a code block.
10. Beginner mistakes and quick fixes
| Mistake | What happens | Fix |
|---|---|---|
| "Make a table" without columns | Different columns every time | Name every column |
| ₹ signs and words in number cells | =SUM() gives 0 or an error |
"Numbers only in the Amount column" |
| Copying the AI's total into a report | A wrong total goes out | Check with =SUM() or =SUMIF() |
| Not listing JSON keys | Key names change between answers | List every key, type and allowed values |
| No rule for missing facts | The AI invents emails or cities | "Use null if not given" |
| Extra text around the JSON | A program cannot read it | "Output only the JSON in a code block" |
| Not testing the JSON | A broken file reaches the app | json.loads() in Python, or a validator |
| Real names and phone numbers in practice files | Privacy risk | Use made-up names and placeholders like 98XXXXXX21 |
11. Try at home
Try at home
Task 1: your spending sheet
- Write your spending for the last 7 days in one messy line.
- Ask for a CSV with the header
Date,Item,Category,Amount. - Open it in Excel and check the total with
=SUM()and each category with=SUMIF().
Task 2: a checklist you will use
- Pick one real event (an exam, a trip, a family function).
- Ask for a checklist in 3 or 4 named groups with "☐ " items.
- Put it in your notes app and tick items as you go.
Task 3: JSON from messages
- Write 3 made-up enquiry messages for any business (a gym, a tuition class, a bakery).
- Choose 6 keys, with types and allowed values.
- Ask for one JSON list, then test it with the Python script (change the
requiredkeys) or a validator. - Break one comma on purpose and read the error.
Recap
In short
- Structured output means telling the AI the exact shape of the answer: a table, a checklist, JSON or CSV.
- Name the parts every time: columns for a table, groups for a checklist, keys for JSON.
- Say what goes in each cell, like "numbers only", so Excel can calculate.
- CSV is the cleanest way to move AI data into Excel or Google Sheets.
- A checklist with named groups and "☐ " items is ready to tick.
- JSON has keys and values; text in double quotes, true/false and null without quotes.
- "Use null if not given" stops the AI from inventing data.
- Test every JSON with
json.loads()or a validator, and check every total with Excel.
You have now finished the prompting core: the 4 parts, examples, steps and shape. Use all four together on one real task this week, and you will feel the difference at work.
Previous chapter: Step-by-Step Prompts: How to Make AI Think Before It Answers
Next chapter: Save Your Best Prompts: Custom GPTs, Gemini Skills and Claude Projects
Ravindra Bagale, trainer: linkedin.com/in/ravindra-bagale. The people, spending, interview, enquiries, email addresses and phone numbers on this page are made up for learning. Wipro is named only to make the situation real; nothing here describes how Wipro hires. The Python check was run on the JSON shown here on 19 October 2026. AI answers change every time, so your output will be similar, not the same.