JSON Schema¶
The schema specifies the data structure of form responses. It must be a valid https://json-schema.org/ object.
Note
This section only provides a brief overview of the structure of JSON Schema, and the other pages in this section provide examples of commonly used schemas used in forms. To learn more about JSON Schema in depth, check out the following resources:
Simple types¶
To create a form with a single field, use the following schema:
{
"type": "string"
}
The other base types other than string include number, boolean, object, array, and null.
Object types¶
You can create object types by specifying a type object and specifying the list of properties in the properties key. Here is a sample object:
{
"type: "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "number"
}
}
}
Array types¶
You can create array types by specifying a type array and specifying the list of properties in the items key. Here is a sample array:
{
"type": "array",
"items": {
"type": "string"
}
}
You can also specify arrays of objects, as follows:
{
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "number"
}
}
}
}