Getting startedComponentsDesign tokensThemingTheme synthesizerFrameworksAccessibilityUtilitiesServer renderingBrowser supportContributingChangelogApp ShellAspect GridAuth ShellCenterContainerDashboard GridFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbarAnchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkStepper NavTabsTop BarTree ViewAccordionAspect RatioAvatarAvatar GroupCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSkeletonSpinnerStackVideoVirtual ListActivity HeatmapAnimated NumberBadgeBar ListChartClockComparisonCountdown TimerData GridDescription ListDiffGaugeJSON TreeKanbanLevel MeterListMeterSparklineStatStepperTagTimelineUptimeValue CardWaveformBlockquoteCode BlockCode GroupGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriterButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerField ListFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree SelectAlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuHover CardLoading OverlayNotification PanelPopoverProgressSheetToastTooltip
ARC UIARC Radiant Components
v4.9DocsComponentsTokensSynthesizer
Getting startedFrameworksServer renderingDesign tokensThemingTheme synthesizerTypographyUtilitiesAll componentsAccessibilityBrowser supportChangelogContributingStatsApp ShellAspect GridAuth ShellCenterContainerDashboard GridFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbarAnchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkStepper NavTabsTop BarTree ViewAccordionAspect RatioAvatarAvatar GroupCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSkeletonSpinnerStackVideoVirtual ListActivity HeatmapAnimated NumberBadgeBar ListChartClockComparisonCountdown TimerData GridDescription ListDiffGaugeJSON TreeKanbanLevel MeterListMeterSparklineStatStepperTagTimelineUptimeValue CardWaveformBlockquoteCode BlockCode GroupGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriterButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerField ListFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree SelectAlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuHover CardLoading OverlayNotification PanelPopoverProgressSheetToastTooltip

JSON Tree

Shows a JSON value as a color-coded tree you expand and collapse, like the object inspector in browser dev tools.

ComponentsJSON Tree
datainteractive
<arc-json-tree>

Overview

JSON Tree renders any JSON value as a collapsible tree, like the object inspector in browser dev tools. Unlike CodeBlock, it loads no highlighter and has no dependencies, so it ships in the standard register barrel. Pass objects and arrays you already hold through the `data` property, or set the `json` attribute to a JSON string for markup-only use. When both are set, `data` wins. Invalid JSON renders a small inline error with the parser's message instead of throwing. `expanded` sets how many levels start open. The default of 1 shows the root's children, and the bare attribute opens every level. Branches page at 100 children, and every row you reveal stays in the DOM, so for large data use VirtualList.

Guidelines

Do

  • Use it to inspect API responses, configuration objects, event payloads and app state
  • Set `expanded="2"` or more when the values you care about are below the first level
  • Pass objects and arrays through `data`, and keep the `json` attribute for static markup
  • Set `keys-quoted` when the output should read as strict JSON. Keys are bare by default, as in dev tools

Don't

  • Don't use it to show source code. CodeBlock highlights whole files in any language
  • Don't use it for navigation like file browsers or menus. TreeView handles selection and custom labels
  • Don't rely on the hover tooltip for string content people need. Show long values another way too

Features

  • Colors use the same tokens as CodeBlock: keys in the secondary accent, strings in the success hue, numbers in the primary accent, booleans and null in the warning hue. A theme that overrides those tokens recolors the tree
  • Guide rails mark nesting depth in the divider color, whatever the value type
  • A collapsed branch shows a muted summary, such as "3 keys" or "12 items"
  • Strings longer than 100 characters truncate in the row, with the full value in the `title` tooltip
  • A branch with more than 100 children shows the first 100 and a "show N more" row that reveals the next 100
  • WAI-ARIA tree pattern with TreeView's keymap: ArrowDown and ArrowUp move between visible rows, ArrowRight expands, ArrowLeft collapses, and Enter or Space toggles

Preview

Usage

This component needs JavaScript. Use the Web Component or a framework wrapper.

<!-- JSON string via attribute -->
<arc-json-tree expanded="2" json='{
  "id": "ord_8134",
  "status": "shipped",
  "paid": true,
  "customer": { "name": "Ada Lovelace", "verified": true }
}'></arc-json-tree>

<!-- Live objects via the data property -->
<arc-json-tree id="inspector" expanded keys-quoted></arc-json-tree>
<script>
  const inspector = document.getElementById('inspector');
  fetch('/api/orders/8134')
    .then((res) => res.json())
    .then((payload) => { inspector.data = payload; });
</script>

API

dataobjectundefined
The value to render. Set as a property for objects and arrays; takes precedence over the json attribute when both are set.
jsonstring''
JSON string alternative to the data property, for attribute-only use. Parsed with try/catch; invalid input renders a small inline error state instead of throwing.
expandednumber | boolean1
How many levels open initially (default 1). As a bare boolean attribute, every level opens.
keysQuotedbooleanfalse
Render object keys with quotes. Off by default, matching devtools.

Events

arc-toggle
Fired when a node is expanded or collapsed, with the node path and new expanded state

See also