jsonToTree
display
Convert any JSON-compatible value to a TreeNode, optionally prefixed by `key` (the property name or array index in the parent container)
Terminal
$termuijs render json-to-tree
Installation
$ bunx termuijs add json-to-tree
Copies the source into src/components/json-to-tree/ and installs @termuijs/core, @termuijs/widgets.
Usage
ts
import { jsonToTree } from '@termuijs/widgets'ts
new jsonToTree(options: JSONViewOptions, style: Partial<Style> = {})API Reference
jsonToTree
| Prop | Type | Required | Description |
|---|---|---|---|
data | unknown | required | The JSON value to display |
onSelect | (node: TreeNode, path: number[]) => void | optional | Callback when a leaf node is selected |
indent | number | optional | Spaces per indent level (default: 2) |