The useful result
Distinguish valid JSON syntax from schema-valid records using one passing and two failing fixtures.
- Distinguish valid JSON syntax from schema-valid records using one passing and two failing fixtures.
- Define the smallest contract
- Run known passing and failing fixtures
- Reject or repair with a visible decision
An AI response can parse as JSON while still missing fields your application needs. This lesson focuses on a separate validation step after generation. Unlike a prompting lesson about producing JSON, the acceptance decision comes from an explicit schema and known fixtures. Keep sample data fictional and avoid uploading private exports to an unapproved checker.
Before you start
- A local or approved JSON Schema validator supporting draft 2020-12
- The fictional schema and fixtures below
Review evidence
Documentation-based review · 2026-10-11
Original editorial workflow. Provider facts were checked against the linked primary references; worked examples are fictional and illustrative, not observed platform tests.
Define the smallest contract
Create a schema for an object with required name and count fields. Set name to a string, count to an integer at least zero, and reject additional properties for this exercise.
Example / expected result
Schema: {"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string"},"count":{"type":"integer","minimum":0}},"required":["name","count"],"additionalProperties":false}
Check your result
The validator accepts the schema itself and uses the intended draft.
Run known passing and failing fixtures
Validate each fictional record separately. Compare errors with the contract instead of asking the assistant whether it looks right.
Example / expected result
Pass: {"name":"Demo","count":2}. Fail: {"name":"Demo"}. Fail: {"name":"Demo","count":"2"}.
Check your result
The first passes; the second fails a required field; the third fails the integer type.
Reject or repair with a visible decision
When an actual AI export fails, save the error path and the original record. Request a corrected record using the same schema, then validate again. Do not silently turn a string into a number unless your application explicitly permits that conversion.
Example / expected result
Expected review note: count had string type; corrected output must be validated again.
Check your result
Only a schema-valid record reaches the next step, and any repair is recorded.
When it goes wrong
Schema validity does not establish that a name or count is true. Validation can reject unexpected properties only when the schema says so. Keep factual source checks separate from shape checks.
Make it your own
Add an unexpected "note" field and a negative count to two new fixtures. Explain which schema keyword rejects each.
Sources and review
Last checked Oct 11, 2026. Features and account limits can change. Verify important results against your original material.
Did this help you complete your task?
Tell us what needs improving. No account or private output required.
Report incorrect information or a broken linkGenius Forges Editorial
Source-linked AI exercises with concrete inputs and result checks.



