Stepthrough Start free

What is a JSON Schema?

Quick answer

A JSON Schema is a standard way to describe what a piece of JSON must look like: which fields it has, what type each one is (text, number, list), and which are required. Tools use it to check data, and AI features use it to force a model's answer into an exact shape.

Last updated

Take the free module →Module 4 of the free n8n for Beginners: Your First Automations course, about 9 minutes. No account needed.

Updated · By Robert Breen

Why it matters for a small business

Automations break on surprises: a missing field, a number sent as text, a list that is sometimes a single value. A schema writes the rules down so a tool can check them. When you ask an AI model for structured output, a schema is how you tell it exactly which fields to return.

Schemas also sit behind AI agents. Each tool an agent can call, including tools shared through the Model Context Protocol, has an input schema that tells the model what to send. That is why a well-described tool gets called with the right fields far more often.

Where you'll use it: in n8n's Structured Output Parser, you can give a JSON example or define a JSON Schema by hand. OpenAI and other model APIs accept schemas for structured outputs, and app APIs document their request bodies with them.

In a real lesson: n8n: Items, JSON and Expressions, Explained by Doing

The free n8n Items, JSON and Expressions lesson has Clearview Bookkeeping's five fake invoices and shows them three ways: Schema, Table and JSON. n8n's Schema view lists the fields of one item, such as client and amount, which is the plain-English version of what a JSON Schema writes formally.

A formal JSON Schema for those invoices would say: an object with a client field of type string and an amount field of type number, both required. Give that to an AI step and every answer comes back with the same two fields, ready for the late fee expression.

n8n manual trigger node with the EDIT OUTPUT box open for set mock data, showing the example JSON and Cancel and Save buttons
n8n manual trigger node with the EDIT OUTPUT box open for set mock data, showing the example JSON and Cancel and Save buttons

Try this lesson free or read the step-by-step guide.

Common confusions

JSON Schema vs n8n Schema view

n8n's Schema view shows the fields it found in your data. A JSON Schema is a written rule set you define for data you expect.

JSON Schema vs database schema

A database schema defines tables and columns. A JSON Schema defines the shape of one JSON document.

Tips

  • Start from a real example and let the tool generate a schema, then tighten it.
  • Mark only truly required fields as required.
  • Add a short description to each field; AI models read them.

More n8n and automation terms

Where you use it: free lessons

Frequently asked questions

Do I need to learn JSON Schema to use n8n?
No. Most of the time a JSON example is enough, and n8n builds the schema from it.
What does required mean in a schema?
The field must be present. Data missing it fails the check, which lets the workflow catch the problem early.

All AI glossary terms, A to Z · Free prompt templates