Lesson 73 · 3 min

Ask for JSON (it is easier than it sounds)

JSON is a tidy, labelled format that lets you move AI answers straight into a sheet, an app or an automation.

JSON is just a way to write information with labels. A contact might look like {"name": "Lan", "phone": "0901 234 567", "city": "Hue"}. Curly brackets hold one thing, square brackets hold a list of things.

Why bother? Because computers read it without guessing. Many spreadsheet tools, automation apps and websites accept JSON, so a chatbot can turn a messy email into clean data you can paste in.

To ask for it, name the labels you want and say "Return only valid JSON, no extra text." Give one tiny example of the shape if you can. That stops the model from inventing its own labels.

Always check the result. Models sometimes miss a comma or add a sentence before the data. A free JSON checker will spot broken formatting in a second, but avoid pasting private data into random websites.

Do it now

Turn a messy note into data

  1. 1. Write or copy a short messy note with a few names, dates or prices in it. Use made-up details.
  2. 2. Paste it into the prompt below.
  3. 3. Look at the labels and check that every value came from your note and nothing was invented.
From the text below, pull out every order.
Return only valid JSON, no extra text, as a list like this:
[{"customer": "", "item": "", "quantity": 0, "date": ""}]
If a value is missing, use null. Do not guess.

Text: [PASTE]

Quick check

What does "Return only valid JSON, no extra text" help prevent?

What does "Return only valid JSON, no extra text" help prevent?

More on this

Words from this lesson

Prompt
The instruction or question you give an AI. Clearer prompts with context usually get much better answers.
API
A doorway that lets one program send requests to another, for example an app asking an AI model for an answer.