Schema
What is JSON Schema?
JSON Schema is a vocabulary that allows you to define the structure, required properties, and data types of JSON data. It is used for validating JSON objects to ensure they follow a specified format.
Basic Example
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Person",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer",
"minimum": 0
},
"email": {
"type": "string",
"format": "email"
}
},
"required": ["name", "age"]
}
Key Keywords
Keyword
Description
$schema
Specifies the JSON Schema version
type
Defines the data type (object, string, integer, array, etc.)
properties
Defines the properties of an object and their schemas
required
Lists properties that must be present
minimum
/ maximum
Numeric limits for number types
format
Predefined formats (e.g., email, date-time)
Last updated