Lesson 1

What Is JSON Schema?

Why schemas exist, what they validate, and where they fit in modern JSON workflows.

JSON Schema is a vocabulary for describing the shape of JSON data. A schema can say that a value must be an object, that the object must include a name field, that tags must be an array of strings, or that an identifier should match a UUID format.

The point is not only documentation. A schema can be used by validators, editors, CI checks, API gateways, and test fixtures.

What a schema describes

At its simplest, a schema answers three questions:

  • What JSON type is allowed?
  • Which fields may or must exist?
  • Which constraints apply to each value?
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": { "type": "string", "format": "uuid" },
    "name": { "type": "string" }
  },
  "required": ["id", "name"]
}

This schema validates shape, not business truth. It can require id, but it cannot prove the id exists in your database unless your application performs that lookup.

Where schemas help

  • Request and response payloads
  • Configuration files
  • Message queues and event streams
  • Test fixtures
  • Generated data from scripts or AI systems

What schemas do not replace

Schemas do not replace parsing JSON, domain validation, authorization checks, or database constraints. They sit at the boundary where raw JSON becomes a value your program is willing to trust.

Good schemas are boring in the best way: they make invalid data fail early, near the system boundary, before it becomes a production debugging story.

When you want to practice, use the related DevCove tool — optional, not part of this lesson.

Open related tool

Back to course overview