Concepts

What is JSON Schema, and why validate?

JSON Schema describes the shape your JSON should take. Learn what it is, how validation helps, and how to generate a schema from a sample.

By The Editorial Team · Reviewed by Engineering · Published 2026-02-18

JSON Schema is a vocabulary for describing the structure of JSON data: which keys are required, what types they hold, and how values are constrained. It turns “I think the API returns this” into a checkable contract.

A tiny example

{
  "type": "object",
  "required": ["name"],
  "properties": {
    "name": { "type": "string" },
    "age": { "type": "integer", "minimum": 0 }
  }
}

Why it’s worth it

  • Catch bad data early instead of deep inside your code.
  • Document the expected shape for teammates and consumers.
  • Generate types, forms, and fake data from one source of truth.

Start from a sample

You don’t have to write a schema by hand. Start from a representative JSON document, describe its shape, then tighten the constraints. Once you have a schema, validate your data against it to catch anything that doesn’t match.

Related articles