Ballmac UI home

JSON Viewer

A collapsible JSON inspector with compact type styling and keyboard-operable branches.

{5}
"workspace": "Product design"
"active": true
"members": 12
"features": {2}
"analytics": true
"exports": [2]
"updatedAt": null

Installation

$ pnpm dlx shadcn@latest add @ballmac/json-viewer

Usage

import { JsonViewer } from "@/components/ballmac/json-viewer"

The full example is in the Code tab above.

Examples

States and variants

API reference

PropTypeDefault
value*

JSON-compatible value to inspect.

unknown—
label

Accessible label for the data.

string—
defaultExpandedDepth

Number of levels open initially.

number1

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Tab / Enter / SpaceFocuses and toggles JSON branches

Use with AI

A collapsible JSON inspector with compact type styling and keyboard-operable branches. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI JSON Viewer (@ballmac/json-viewer) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Inspect nested API responses or configuration

Not for

  • Use Code Block for unstructured text

Registry JSON: https://ui.ballmac.com/r/json-viewer.json

Credits

Free to use in personal and commercial projects.