Web · Components
JsonView
JSON viewer: shows data such as API responses, config files and log entries as a colored, collapsible tree.
8 exports
Live example
Preview
{8 keys
id: 1042,
status: "active",
customer: {6 keys
name: "Ayşe Yılmaz",
email: "[email protected]",
profile: "https://example.com/u/ayse",
vip: true,
puan: 4.8,
notlar: null
},
products: [2 items
0: {…}4 keys,
1: {…}4 keys
],
tags: [2 items
0: "express-shipping",
1: "gift-package"
],
created: "2026-11-11T09:42:00.000Z",
description: "The customer asked for delivery after 18:00 on weekdays. The doorbell doesn't work, please call by phone. The package co",
measurements: [240 items
[0 … 99],
0: 0,
1: 12.5,
2: 24.7,
3: 36.6,
4: 47.9,
5: 58.5,
6: 68.2,
7: 76.8,
8: 84.1,
9: 90.2,
10: 94.9,
11: 98.1,
12: 99.7,
13: 99.9,
14: 98.4,
15: 95.4,
16: 90.9,
17: 85,
18: 77.8,
19: 69.4,
20: 59.8,
21: 49.4,
22: 38.2,
23: 26.3,
24: 14.1,
25: 1.7,
26: -10.8,
27: -23.1,
28: -35.1,
29: -46.5,
30: -57.2,
31: -66.9,
32: -75.7,
33: -83.2,
34: -89.5,
35: -94.4,
36: -97.8,
37: -99.6,
38: -99.9,
39: -98.7,
40: -95.9,
41: -91.6,
42: -85.9,
43: -78.8,
44: -70.6,
45: -61.2,
46: -50.8,
47: -39.7,
48: -27.9,
49: -15.8,
50: -3.3,
51: 9.2,
52: 21.5,
53: 33.5,
54: 45,
55: 55.8,
56: 65.7,
57: 74.6,
58: 82.3,
59: 88.7,
60: 93.8,
61: 97.4,
62: 99.5,
63: 100,
64: 98.9,
65: 96.3,
66: 92.3,
67: 86.7,
68: 79.8,
69: 71.7,
70: 62.5,
71: 52.2,
72: 41.2,
73: 29.5,
74: 17.4,
75: 5,
76: -7.5,
77: -19.9,
78: -32,
79: -43.5,
80: -54.4,
81: -64.4,
82: -73.5,
83: -81.4,
84: -88,
85: -93.2,
86: -97,
87: -99.3,
88: -100,
89: -99.2,
90: -96.8,
91: -92.9,
92: -87.5,
93: -80.8,
94: -72.9,
95: -63.8,
96: -53.7,
97: -42.7,
98: -31.1,
99: -19
[100 … 199],
[200 … 239]
]
}
Code
Events
- Events appear here when you interact with the preview.
JSON text (invalid)
Invalid JSON
Expected double-quoted property name in JSON at position 27 (line 1 column 28)
Import
JSON viewer: shows data such as API responses, config files and log entries as a colored, collapsible tree.
- Navigation: containers expand on click; expand/collapse all in the toolbar. Keyboard: ↑/↓ rows, → expands or enters, ← collapses or goes to the parent container, Enter toggles, Ctrl/⌘ + C copies the focused value.
- Search: searches keys and values case-insensitively (Turkish-aware), expands the paths of matches automatically and highlights them; Enter goes to the next result.
- Copying: copy a row's value (formatted JSON) or its path (
users[0].name). - Large data: only the expanded part is traversed; long arrays are split into chunks of 100, long strings are truncated, and more than 400 rows are virtualized.
- Safe: Map, Set, Date, bigint,
undefinedand circular references are shown without errors. Colors come from theCodeBlocktheme.
Examples
kindOf
functionType of a value.
formatPath
functionConverts a path to JavaScript access text: ["users", 0, "name"] → users[0].name. A root name, when given, is prepended.
toJsonText
functionConverts a value to clipboard-friendly JSON text: Map becomes an object, Set an array, dates ISO strings, bigint numeric strings; circular references become "[Circular]".
JsonViewClassNames
interfaceClasses that can be passed to the inner parts of JsonView.
| Name | Type | Description |
|---|---|---|
toolbar? | string | Top toolbar. |
viewport? | string | Scrolled area. |
row? | string | Row. |
JsonViewProps
interfaceProps of the JsonView component.
| Name | Type | Default | Description |
|---|---|---|---|
data? | unknown | Value to show: an object, array or primitive. Map, Set, Date, bigint and circular references are shown safely too. | |
value? | string | JSON text; given instead of data, an error is shown if it can't be parsed. | |
defaultExpanded? | number | boolean | 2 | How many levels are initially expanded? true all, false only the root is collapsed. |
rootName? | string | Name of the root; prepended when copying a path (e.g. "response" → response.users[0]). | |
sortKeys? | boolean | false | Sort keys alphabetically? |
quoteKeys? | boolean | false | Write keys quoted ("name":)? |
collapseStringsAfter? | number | 120 | Strings longer than this are truncated and expand fully on click. 0 disables. |
groupArraysAfter? | number | 100 | Arrays longer than this are split into [0 … 99] chunks. |
toolbar? | boolean | true | Top toolbar (search, expand/collapse all, copy). |
search? | boolean | true | Search box in the toolbar. |
copyable? | boolean | true | "Copy value" and "copy path" buttons on rows. |
linkify? | boolean | true | Should strings starting with http(s):// become links? |
onSelect? | (path: JsonPathSegment[], value: unknown) => void | Called with the path and value when a key is clicked (e.g. to open a detail panel). | |
maxHeight? | string | "32rem" | Maximum height of the visible area; it scrolls beyond that and more than 400 rows are virtualized. "none" is unlimited. |
label? | string | "JSON"` (`messages.jsonView`) | Screen reader name. |
className? | string | Classes added to the container. | |
classNames? | JsonViewClassNames | Classes added to the inner parts. |
JsonKind
typeType of a value inside JsonView.
JsonPathSegment
typePath segment: object key or array index.