Skip to content
Calm motion: animations on this site only fade, with no movement

JsonViewer ​

Any value as an open-and-close tree

Any value as a tree that people open and close: an API response, a store, a configuration object. Use it in developer tools and admin screens. It shows data and does not edit it. For a tree that you build yourself, use Tree.

Basic
  • response: {6}
    • tags: [3]
  • value can be any value. Objects show as key: {3} and arrays as key: [3], with the count of children. Other values show on one line: "text", 12, true, null.
  • openDepth sets how many levels below the root start open (default 1). labels.root names the root line.
  • limit caps the children shown per object or array (default 100). A longer one ends with a disabled line, "… 9900 more". Long strings are cut at 120 characters.
  • A value that points back to one of its parents shows as [circular]. The viewer does not loop.
  • It is a Tree, so the keyboard works the same way: arrows move, → opens, ← closes. Name it for screen readers with label.
  • jsonToNodes is exported if you want the nodes for your own Tree.

Usage ​

ts
import { BlessJsonViewer } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
value*unknown—any value: a parsed JSON response, a store, a config object
openDepthnumber1levels below the root that start open
limitnumber100children shown per object or array before a "… n more" line
labelstring"JSON"names the tree for screen readers
labelsPartial<{ root: string; }>—

Released under the MIT License. Character names and artwork belong to their owners.