Object properties
Object properties create sections and groups. The root of every form is an object, and you can nest more objects to organize related questions.
Core fields
| Field | Meaning |
|---|---|
properties | The child fields inside the object. |
required | Child fields that must be answered. |
dependencies | Follow-up fields shown or required after another field is answered. |
minProperties | Minimum number of child answers. |
maxProperties | Maximum number of child answers. |
Basic section
"visit": {
"title": "Visit details",
"type": "object",
"properties": {
"reason": {
"title": "Reason for visit",
"type": "string",
"description": "Why the patient came today"
},
"priority": {
"title": "Priority",
"type": "string",
"enum": ["Routine", "Urgent"]
}
},
"required": ["reason"]
}
Dependencies
Dependencies mean:
If this field is answered, also ask these follow-up fields.
Example:
"surgery": {
"title": "Surgery",
"type": "object",
"properties": {
"had-surgery": {
"title": "Had surgery?",
"type": "boolean"
},
"surgery-type": {
"title": "Type of surgery",
"type": "string",
"oneOf": [
{ "const": "ARTHROSCOPY", "title": "Arthroscopy" },
{ "const": "REPAIR", "title": "Repair" },
{ "const": "REPLACEMENT", "title": "Replacement" },
{ "const": "OTHER", "title": "Other" }
]
},
"surgery-date": {
"title": "Surgery date",
"type": "string",
"format": "date"
}
},
"dependencies": {
"had-surgery": ["surgery-type", "surgery-date"]
}
}
Here, surgery-type and surgery-date are follow-ups to had-surgery.
For more complex logic, use conditions.