JSON Editor
The json-editor type renders a code editor with JSON syntax highlighting, bracket matching, and real-time parse error detection. The stored value is a parsed JavaScript object (not a string). An optional JSON Schema can be provided for structural validation beyond parse correctness.
Minimal Example
{
"id": "config",
"type": "json-editor",
"label": "Configuration",
"width": "full",
"binding": {
"source": "$json",
"path": "node.config"
}
}
Settings Reference
| Setting | Type | Default | Description |
|---|---|---|---|
height | string (CSS) | "300px" | Editor height. Use "auto" to grow with content. |
minHeight | string (CSS) | — | Minimum height when height: "auto" |
maxHeight | string (CSS) | — | Maximum height before scrolling when height: "auto" |
schema | JSONSchema object | — | JSON Schema draft-07 for structural validation |
mode | json | text | json | Editor mode. text skips JSON parse validation. |
readOnly | boolean | false | Lock the editor from editing (syntax highlight only) |
lineNumbers | boolean | true | Show line numbers in the gutter |
foldGutter | boolean | true | Show collapse/expand arrows for objects and arrays |
formatOnLoad | boolean | true | Auto-format (pretty-print) the JSON when the form loads |
tabSize | number | 2 | Spaces per indent level |
Stored Value Format
The JSON editor stores and returns a parsed JavaScript object/array — not a JSON string. When the editor content is invalid JSON, the field value is null and a parse error is shown:
// User types valid JSON: { "key": "value" }
// Stored value: { key: "value" } ← JS object
// User types invalid JSON: { key: value }
// Stored value: null
// Error shown: "Invalid JSON: Unexpected token 'v'"
JSON Schema Validation
Provide a JSON Schema (draft-07) in settings.schema to validate the structure of the entered JSON beyond parse correctness:
{
"id": "webhook-config",
"type": "json-editor",
"label": "Webhook Configuration",
"width": "full",
"settings": {
"height": "250px",
"schema": {
"type": "object",
"required": ["url", "events"],
"properties": {
"url": {
"type": "string",
"format": "uri",
"description": "The webhook endpoint URL"
},
"events": {
"type": "array",
"items": { "type": "string" },
"minItems": 1,
"description": "List of event names to subscribe to"
},
"secret": {
"type": "string",
"description": "Optional HMAC signing secret"
}
},
"additionalProperties": false
}
},
"defaultValue": {
"url": "https://",
"events": ["form.submitted"]
}
}
Auto-Height Mode
For forms where JSON content length varies greatly, use auto-height with bounds:
{
"id": "metadata",
"type": "json-editor",
"label": "Metadata",
"settings": {
"height": "auto",
"minHeight": "150px",
"maxHeight": "600px",
"formatOnLoad": true
}
}
Read-Only Display
In view and preview modes, the JSON editor renders as a read-only syntax-highlighted code block. You can also force read-only in edit mode for display-only JSON fields:
{
"id": "response-preview",
"type": "json-editor",
"label": "API Response",
"settings": {
"readOnly": true,
"height": "200px",
"lineNumbers": false,
"foldGutter": true
},
"modeVisibilitySettings": {
"edit": true,
"view": true,
"admin": true,
"preview": false,
"design": false
}
}
Default Value
Provide a defaultValue as a JavaScript object (not a JSON string). Atlas Forms will pretty-print it when the editor initialises:
{
"id": "node-settings",
"type": "json-editor",
"label": "Node Settings",
"defaultValue": {
"retryCount": 3,
"timeoutMs": 5000,
"headers": {}
}
}
Common Use Cases
| Use Case | Configuration Notes |
|---|---|
| Workflow node configuration | Use with JSON Schema for structured validation |
| API request body template | 400–600px height, foldGutter enabled |
| Debug / response viewer | readOnly: true, no validation |
| Settings overrides | Small height (200px), schema for known shape |
| Raw data input | mode: "text" to allow any text, not just valid JSON |
textarea control and parse manually in your submit handler. The editor's real-time parsing and syntax highlighting become slow above this threshold.