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]
valuecan be any value. Objects show askey: {3}and arrays askey: [3], with the count of children. Other values show on one line:"text",12,true,null.openDepthsets how many levels below the root start open (default 1).labels.rootnames the root line.limitcaps 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. jsonToNodesis exported if you want the nodes for your own Tree.
Usage
ts
import { BlessJsonViewer } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
value* | unknown | — | any value: a parsed JSON response, a store, a config object |
openDepth | number | 1 | levels below the root that start open |
limit | number | 100 | children shown per object or array before a "… n more" line |
label | string | "JSON" | names the tree for screen readers |
labels | Partial<{ root: string; }> | — |