Practice worksheet — teaching exercise, no fabricated results Get verifiable JSON from AI: prompt, schema, and rejection tests Use AI for constrained JSON output, enforce a schema and reject incorrect types or fields with independent checks. 1. Think of JSON as a labeled library card Complete the lesson practice. Record the actual result or why it remains unverified: Lesson-specific self-check: Why explicitly request JSON value types? Reference answer (try before reading): A program distinguishes strings, integers and booleans even when their printed forms look similar. My response / what I tried: ____________________________________________________________ How did I verify it / what remains unchecked? ____________________________________________________________ 2. Define a contract that restricts the shape Complete the lesson practice. Record the actual result or why it remains unverified: Lesson-specific self-check: What does additionalProperties:false enforce? Reference answer (try before reading): It rejects fields not included in the permitted object shape. My response / what I tried: ____________________________________________________________ How did I verify it / what remains unchecked? ____________________________________________________________ 3. Create a small JSON Schema Complete the lesson practice. Record the actual result or why it remains unverified: Lesson-specific self-check: Does schema validation prove the books are real? Reference answer (try before reading): No, it proves structure and types, not external facts. My response / what I tried: ____________________________________________________________ How did I verify it / what remains unchecked? ____________________________________________________________ 4. Include deliberate failure cases Complete the lesson practice. Record the actual result or why it remains unverified: Lesson-specific self-check: Why does year="2020" fail an integer field? Reference answer (try before reading): It is a quoted string instead of a numeric integer. My response / what I tried: ____________________________________________________________ How did I verify it / what remains unchecked? ____________________________________________________________ 5. Build a full AI-to-validation loop Complete the lesson practice. Record the actual result or why it remains unverified: Lesson-specific self-check: How should you fix a single failing field? Reference answer (try before reading): Identify the precise rule, correct only the field and revalidate without altering other values. My response / what I tried: ____________________________________________________________ How did I verify it / what remains unchecked? ____________________________________________________________ Final project: input An AI assistant should produce three purely fictional books with title, year and available fields. Reference deliverable Prompt: “Return an array of three fictional books as JSON, title string, year integer, available boolean; no extra keys.” Sample: {"title":"Journey","year":2020,"available":true} Schema: array of objects, three fields required, no additional properties. Intentional failure: {"title":"Journey","year":"2020","available":"yes"}. Repair the wrong types, then run validation again. Acceptance criteria Working prompt, parsable example, clear JSON Schema and a rejected bad record; fictional data labeled honestly. Note: do not invent a test result or enter sensitive data in examples.