JSON#

This component is also available in the classic reference.

The JSON pane allows rendering arbitrary JSON strings, dicts and other json serializable objects in a panel.

Use pn.ui.JSON to create this component.

API#

.. py:class:: JSON(object=None, **params) :module: panel.pane.markup

The JSON pane allows rendering arbitrary JSON strings, dicts and other json serializable objects in a panel.

Reference: https://panel.holoviz.org/reference/panes/JSON.html

:Example:

JSON(json_obj, theme=’light’, height=300, width=500)

:Attributes:

   **encoder**
       ..

   **priority**
       ..

.. rubric:: Methods

.. autosummary::

  applies

.. !! processed by numpydoc !!

Parameter Definitions


Parameters inherited from:

   :class:`panel.viewable.Layoutable`: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

   :class:`panel.viewable.Viewable`: loading

   :class:`panel.pane.base.PaneBase`: margin, default_layout, object

   :class:`panel.pane.markup.HTMLBasePane`: enable_streaming

depth = Integer(bounds=(-1, None), default=1, inclusive_bounds=(True, True), label='Depth')

    Depth to which the JSON tree will be expanded on initialization.

encoder = ClassSelector(allow_None=True, class_=<class 'json.encoder.JSONEncoder'>, label='Encoder')

    Custom JSONEncoder class used to serialize objects to JSON string.

hover_preview = Boolean(default=False, label='Hover preview')

    Whether to display a hover preview for collapsed nodes.

theme = Selector(default='light', label='Theme', names={}, objects=['light', 'dark'])

    If no value is provided, it defaults to the current theme
    set by pn.config.theme, as specified in the
    JSON.THEME_CONFIGURATION dictionary. If not defined there, it
    falls back to the default parameter value.

.. py:method:: JSON.applies(object: ~typing.Any, **params) -> float | bool | None :module: panel.pane.markup :classmethod:

  Returns boolean or float indicating whether the Pane
  can render the object.

  If the priority of the pane is set to
  `None`, this method may also be used to define a float priority
  depending on the object being rendered.















  ..
      !! processed by numpydoc !!

.. py:attribute:: JSON.priority :module: panel.pane.markup :type: t.ClassVar[float | bool | None] :value: None