jsonform
value.json
{
"size": 1,
"container1": {
"name": "Initial Name for Container 1",
"image": "https://example.com/image.png"
},
"container2": {
"name": "Initial Name for Container 2",
"url": "https://example.com"
}
}
schema.json
{
"type": "object",
"properties": {
"size": {
"type": "integer",
"title": "Size",
"enum": [1, 2],
"default": 1
},
"container1": {
"type": "object",
"title": "Container 1",
"properties": {
"name": {
"type": "string",
"title": "Name"
},
"image": {
"type": "string",
"title": "Image URL"
}
}
},
"container2": {
"type": "object",
"title": "Container 2",
"properties": {
"name": {
"type": "string",
"title": "Name"
},
"url": {
"type": "string",
"title": "URL"
}
}
}
}
}
ui-schema.json
{
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"scope": "#/properties/size",
"label": "Size",
"options": {
"format": "radio"
}
},
{
"type": "Group",
"label": "Container 1",
"elements": [
{
"type": "Control",
"scope": "#/properties/container1/properties/name",
"label": "Name"
},
{
"type": "Control",
"scope": "#/properties/container1/properties/image",
"label": "Image URL"
}
],
"rule": {
"effect": "SHOW",
"condition": {
"scope": "#/properties/size",
"schema": {
"const": 1
}
}
}
},
{
"type": "Group",
"label": "Container 2",
"elements": [
{
"type": "Control",
"scope": "#/properties/container2/properties/name",
"label": "Name"
},
{
"type": "Control",
"scope": "#/properties/container2/properties/url",
"label": "URL"
}
],
"rule": {
"effect": "SHOW",
"condition": {
"scope": "#/properties/size",
"schema": {
"const": 2
}
}
}
}
]
}
result

other info
If it is a simple string, then it is fine.
jsonform
value.json
{ "size": 1, "container1": { "name": "Initial Name for Container 1", "image": "https://example.com/image.png" }, "container2": { "name": "Initial Name for Container 2", "url": "https://example.com" } }schema.json
{ "type": "object", "properties": { "size": { "type": "integer", "title": "Size", "enum": [1, 2], "default": 1 }, "container1": { "type": "object", "title": "Container 1", "properties": { "name": { "type": "string", "title": "Name" }, "image": { "type": "string", "title": "Image URL" } } }, "container2": { "type": "object", "title": "Container 2", "properties": { "name": { "type": "string", "title": "Name" }, "url": { "type": "string", "title": "URL" } } } } }ui-schema.json
{ "type": "VerticalLayout", "elements": [ { "type": "Control", "scope": "#/properties/size", "label": "Size", "options": { "format": "radio" } }, { "type": "Group", "label": "Container 1", "elements": [ { "type": "Control", "scope": "#/properties/container1/properties/name", "label": "Name" }, { "type": "Control", "scope": "#/properties/container1/properties/image", "label": "Image URL" } ], "rule": { "effect": "SHOW", "condition": { "scope": "#/properties/size", "schema": { "const": 1 } } } }, { "type": "Group", "label": "Container 2", "elements": [ { "type": "Control", "scope": "#/properties/container2/properties/name", "label": "Name" }, { "type": "Control", "scope": "#/properties/container2/properties/url", "label": "URL" } ], "rule": { "effect": "SHOW", "condition": { "scope": "#/properties/size", "schema": { "const": 2 } } } } ] }result
other info
If it is a simple string, then it is fine.