# JSON

Pretty-printed JSON with collapsible nodes



<ComponentPreview base="ink" name="json-demo" />

Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add @termcn/json
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource base="ink" name="json" title="components/ui/json.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</CodeTabs>

Usage [#usage]

```tsx
import { JSONView } from "@/components/ui/json";
```

```tsx
<JSONView
  label="package.json"
  data={{
    name: "my-cli",
    version: "1.0.0",
    dependencies: { ink: "^5.0.0" },
  }}
/>
```

API Reference [#api-reference]

JSONView [#jsonview]

| Prop        | Type      | Default    |
| ----------- | --------- | ---------- |
| `data`      | `unknown` | `required` |
| `indent`    | `number`  | `2`        |
| `collapsed` | `boolean` | `false`    |
| `label`     | `string`  | -          |
