Methods

Methods

Jedison provides several methods to interact with your editor instance:

getValue()

Returns the current value of the editor by calling getValue() on the root instance.

Internally, this traverses the entire instance tree to build the complete JSON structure.

setValue(data)

Updates the editor's value with new data by calling setValue() on the root instance.

  • data: The new JSON data to set

getInstance(jsonPath)

Retrieves a specific instance by its JSON path.

Example paths:

  • '#' - Root instance
  • '#/property' - Nested property
  • '#/array/0' - First item in an array

showValidationErrors(errorsList = null)

Displays validation errors in the respective editors.

  • If errorsList is provided, displays those specific errors
  • Otherwise, shows all current validation errors from getErrors()

getErrors(filters = ['error'])

Returns an array of validation error messages from all instances.

  • filters: Include only errors with type that are included in the filter array
jedison.getErrors(filters = ['error, 'warning'])
[
  {
    "type": "error",
    "path": "#",
    "constraint": "minLength",
    "messages": [
      "Must be at least 4 characters long."
    ]
  },
  {
    "type": "warning",
    "path": "#",
    "constraint": "x-my-constraint",
    "messages": [
      "Value should be equal to \"test\"."
    ]
  }
]
jedison.getErrors(filters = ['error])
[
  {
    "type": "error",
    "path": "#",
    "constraint": "minLength",
    "messages": [
      "Must be at least 4 characters long."
    ]
  }
]

disable()

Disables UI controls

enable()

Enables UI controls

destroy()

Cleans up the editor instance by:

  • Calling destroy() on the root instance
  • Clearing the container HTML if in editor mode
  • Removing all instance references