# JSON Schema
Describe [[JSON]] schema. Then provide an example. Then make a list of possible types.
> [!ai]+ AI
>
> JSON schema is a vocabulary that allows you to annotate and validate JSON documents. It describes your existing data format in clear, human, and machine-readable documentation. It provides a contract for the JSON data required by a given application and how that data can be modified.
> [!ai]+ AI
> Example of JSON Schema:
> ```
> {
> "$schema": "http://json-schema.org/draft-07/schema#",
> "title": "Product",
> "description": "A product from Acme's catalog",
> "type": "object",
> "properties": {
> "id": {
> "description": "The unique identifier for a product",
> "type": "integer"
> },
> "name": {
> "description": "Name of the product",
> "type": "string"
> },
> "price": {
> "type": "number",
> "exclusiveMinimum": 0
> }
> },
> "required": ["id", "name", 'price']
> }
> ```
> In this example, we are defining a JSON schema for a product object. The product has three properties: id (an integer), name (a string), and price (a number with an exclusive minimum of 0). The id, name, and price properties are required.
> [!ai]+ AI
> Possible types in JSON Schema:
> 1. String
> 2. Number
> 3. Object
> 4. Array
> 5. Boolean
> 6. Null
> 7. Integer
## Used by
- [[OpenAI]] API for [[LLM functions]]