Formsort
Search…
JSON Schemas
Exporting form payload metadata for validation or analysis.
Every variant revision is available as a JSON schema (Draft 07), which describes the possible answer payloads that a flow may produce. Exporting this JSON allows you to write validators on your end, or understand the possible payloads that a flow may produce using the many tools that use the JSON Schema format.

Sample form schemas

Each of these examples shows how a form that only collected a single answer would be respresented in a JSON schema
string
select (single)
select (multiple)
address
1
{
2
'$schema': 'http://json-schema.org/draft-07/schema#',
3
'type': 'object',
4
'properties': {
5
'user_fname': {
6
'type': 'string',
7
'description': 'The first name of the user'
8
}
9
}
10
}
Copied!
1
{
2
'$schema': 'http://json-schema.org/draft-07/schema#',
3
'type': 'object',
4
'properties': {
5
'A choice': {
6
'oneOf': [
7
{'const': 'Value A'},
8
{'const': 'Value B'}
9
]
10
}
11
}
12
}
Copied!
1
{
2
'$schema': 'http://json-schema.org/draft-07/schema#',
3
'type': 'object',
4
'properties': {
5
'A choice': {
6
'type': 'array',
7
'items': {
8
'oneOf': [
9
{'const': 'Value A'},
10
{'const': 'Value B'}
11
]
12
}
13
}
14
}
15
}
Copied!
Note that address is the only current object answer type with a distinct object type definition. Custom object types will be supported in the future.
1
{
2
"$schema":"http://json-schema.org/draft-07/schema#",
3
"type":"object",
4
"definitions":{
5
"address":{
6
"type":"object",
7
"properties":{
8
"raw":{
9
"type":"string"
10
},
11
"address_1":{
12
"type":"string"
13
},
14
"address_2":{
15
"type":"string"
16
},
17
"city":{
18
"type":"string"
19
},
20
"state":{
21
"type":"string"
22
},
23
"postal_code":{
24
"type":"string"
25
},
26
"country":{
27
"type":"string"
28
}
29
},
30
"required":[
31
"address_1",
32
"city",
33
"state",
34
"postal_code"
35
]
36
}
37
},
38
"properties":{
39
"An address":{
40
"type":"array",
41
"items":{
42
"$ref":"#/definitions/address"
43
}
44
}
45
}
46
}
Copied!
Note that none of the root object properties are marked required: if you are receiving events with answers on every step, you may receive partial payloads, so you cannot assume the presence of any answer.

Accessing the JSON schema for a flow

The JSON schema for a given flow, variant, and revision combination is available at the following URL:
1
https://variant.formsort.com/flow-api/client/{CLIENT_ID}/flow/{FLOW_LABEL}/variant/{VARIANT_LABEL}/revision/{VARIANT_REVISION_UUID}/schema.json
Copied!