Skip to content

JSONView

widgetsdisplay

JSONView: a syntax-colored, collapsible JSON viewer

Installation

$ bunx termuijs add j-s-o-n-view

Copies the source into src/components/j-s-o-n-view/ and installs @termuijs/core, @termuijs/widgets.

Usage

ts
import { JSONView } from '@termuijs/widgets'
ts
new JSONView(options: JSONViewOptions, style: Partial<Style> = {})

API Reference

JSONView

PropTypeRequiredDescription
dataunknownrequiredThe JSON value to display
onSelect(node: TreeNode, path: number[]) => voidoptionalCallback when a leaf node is selected
indentnumberoptionalSpaces per indent level (default: 2)
#display#j-s-o-n-view