Why format matters#
The most common time-waster with AI is getting a correct answer in the wrong shape - a paragraph when you needed a table, a table when you needed code-readable data. Always say what shape you want.
Common formats and how to ask#
| You need | Ask for |
|---|---|
| Quick reading | "exactly 5 bullet points, each under 15 words" |
| Comparison | "a table with columns: Feature, Option A, Option B, Winner" |
| Excel / Google Sheets | "CSV with header row: Name,Email,City - no extra text" |
| Program input | "valid JSON only, matching this structure: ..." |
| Document | "Markdown with H2 headings: Overview, Steps, Risks" |
| Fill-in template | "use exactly this template: ..." |
| Short answer | "answer with one word: Yes or No" |
AI का जवाब सही हो, यह काफ़ी नहीं - वह सही रूप (format) में भी होना चाहिए, ताकि आप उसे सीधे इस्तेमाल कर सकें।
- Excel में paste करना है? → CSV या table माँगें।
- Python program में इस्तेमाल करना है? → JSON माँगें।
- Report/notes चाहिए? → headings और bullet points माँगें।
जितना साफ़ आप format बताएंगे (columns के नाम, keys के नाम, कितने points), उतना कम दोबारा काम करना पड़ेगा।
Tables#
Compare Python, Java and JavaScript for a fresher choosing a first language.
Return a Markdown table with columns: Criteria | Python | Java | JavaScript.
Rows: Ease of learning, Job demand in India, Typical salary range for freshers,
Best used for, Learning time to job-ready.
After the table, give a 2-line recommendation.
CSV for Excel#
Extract every person mentioned in the text below.
Return ONLY CSV with this header: Name,Role,Company,City
Use "Unknown" for missing values. No explanation, no code fences.
<text>
...
</text>
Copy the reply into a .csv file or paste into Excel and use Data → Text to Columns.
JSON for programs#
Show the exact structure, with key names and value types:
Extract the order details from the WhatsApp message below.
Return only valid JSON in this exact structure:
{
"customer_name": string,
"items": [{"name": string, "quantity": integer}],
"delivery_date": "YYYY-MM-DD" or null,
"address": string or null
}
<message>
Hi, this is Meena. Please send 2 kg basmati rice and 3 packets of
Tata salt to 14 Saket Nagar by Saturday 29 Nov.
</message>
Expected reply:
{
"customer_name": "Meena",
"items": [
{"name": "basmati rice (kg)", "quantity": 2},
{"name": "Tata salt (packet)", "quantity": 3}
],
"delivery_date": "2026-11-29",
"address": "14 Saket Nagar"
}
Many AI APIs also offer a structured output / JSON mode setting that guarantees valid JSON matching a schema. When you build real applications, use it. In chat tools, the prompt above works well.
Parsing AI output safely in Python#
AI replies are text. Even when you ask for "JSON only", you might get code fences or a sentence around it. Write code that cleans and checks:
Always validate - check required keys exist and values have sensible types before using them.
Templates - fill in the blanks#
Give a skeleton and ask the model to fill it:
Create a lesson plan using exactly this template:
TOPIC:
CLASS:
DURATION: 45 minutes
LEARNING OBJECTIVES: (3 bullets)
WARM-UP (5 min):
MAIN ACTIVITY (25 min):
PRACTICE (10 min):
HOMEWORK:
Topic: Python dictionaries. Class: B.Sc. first year.
Controlling style inside the format#
- "Use bold only for key terms."
- "No emojis."
- "Write in prose paragraphs, not bullet points." (useful when AI over-uses bullets)
- "Code blocks with language tags; comments in English."
- "Numbers in Indian format (1,00,000)."
Prefill / start the answer#
In some tools and APIs you can start the assistant's reply yourself. Starting it with { strongly pushes the model to continue with JSON. In chat, a similar trick is ending your prompt with the first line of the output you expect:
...Return the table.
| Criteria | Python | Java |
|---|---|---|
Summary#
- Always specify the output shape: bullets, table, CSV, JSON, Markdown sections or a template.
- For programs, show the exact JSON structure and say "only JSON".
- Parse AI output defensively: strip extra text,
json.loads, validate required keys. - Use CSV for Excel; templates for consistent documents.