Skip to main content

JSON Editor

The JSON Editor component provides a full-featured code editor for writing and editing JSON data directly within your application. It includes syntax highlighting, code folding, bracket matching, and real-time validation, making it ideal for building configuration panels, API request builders, or any interface where users need to input structured JSON.

Example Usage

A DevOps team builds an internal tool to manage feature flags across multiple services. The JSON Editor component lets engineers directly edit the flag configuration as JSON, with syntax highlighting and validation that immediately catches malformed input before it's saved to the database.

Properties

Property
Description
Expected Value
JSONSets the JSON data displayed in the editor.A valid JSON Object or Array.
ThemeSets the color theme for the editor.Select from: monokai, solarized (default), tomorrow, or bespin.

Component Specific Actions (CSA)

Following actions of the component can be controlled using the component specific actions(CSA):

Action
Description
How To Access
setValueSets the JSON value of the editor. Accepts a JSON object or array.components.jsoneditor1.setValue({key: "value"})
setLoadingToggles the loading state of the editor.components.jsoneditor1.setLoading(true)
setVisibilityToggles the visibility of the editor.components.jsoneditor1.setVisibility(false)
setDisableToggles the disabled state of the editor.components.jsoneditor1.setDisable(true)

Exposed Variables

Variable
Description
How To Access
valueHolds the current JSON value from the editor as a parsed object.{{components.jsoneditor1.value}}
isValidReturns true if the current content is valid JSON, false otherwise.{{components.jsoneditor1.isValid}}
isVisibleReturns the current visibility state of the component.{{components.jsoneditor1.isVisible}}
isLoadingReturns the current loading state of the component.{{components.jsoneditor1.isLoading}}
isDisabledReturns the current disabled state of the component.{{components.jsoneditor1.isDisabled}}

Additional Actions

Action
Description
Configuration Options
Expand entire JSONControls whether the JSON tree is fully expanded or collapsed when loaded.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
Dynamic heightAutomatically adjusts the component's height based on its content. Only applies in the viewer mode.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
Loading stateEnables a loading spinner, often used with isLoading to indicate progress.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
VisibilityControls component visibility.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
DisableDisables the component and makes the editor read-only.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
TooltipProvides additional information on hover. Set a string value for display.String (e.g., Edit your JSON configuration here.).

Devices

Property
Description
Expected Value
Show on desktopMakes the component visible in desktop view.You can set it with the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
Show on mobileMakes the component visible in mobile view.You can set it with the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.

Styles

Container

Property
Description
Configuration Options
BackgroundSets the background color of the editor.Select a color from the color picker or set it programmatically using fx.
Border colorSets the border color of the editor container.Select a color from the color picker or set it programmatically using fx.
Border radiusSets the corner radius of the editor container.Enter a numeric value (default: 6) or set it programmatically using fx.
Box shadowSets the box shadow around the editor container.Use the box shadow picker or set it programmatically using fx.
info

Any property having fx button next to its field can be programmatically configured.



Need Help?