React Native · Components
JsonView
JSON viewer: shows data like API responses, config files or log entries as a colored, collapsible tree.
3 exports
Live example
The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.
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
JsonView
componentJSON viewer: shows data like API responses, config files or log entries as a colored, collapsible tree. The same core (@yasinsensoy/core/json-view) and the same features as JsonView on web.
- Navigation: containers expand on press; expand/collapse all in the toolbar.
- Search: searches keys and values ignoring Turkish letter case, expands and highlights the paths of matches automatically; the keyboard's "search" key and the arrows scroll to the next or previous result.
- Copy: long-press a row → copy the value (formatted JSON) or the path (
users[0].name). Since there is no hover on mobile, a long-press menu is used instead of web's row buttons. - Large data: only the expanded part is traversed; long arrays are split into chunks of 100, long strings are truncated, rows are drawn in a virtual list (only the visible ones).
- Safe: Map, Set, Date, bigint,
undefinedand circular references are shown without errors. Colors come from theCodeBlocktheme (ui.code). - On mobile long lines wrap instead of scrolling horizontally.
Examples
JsonPathSegment
typePath segment: object key or array index.
JsonViewProps
interfaceProps of the JsonView component (same names as on web).
| 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 cannot be parsed. | |
defaultExpanded? | number | boolean | 2 | How many levels are expanded initially? true all, false only the root 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 with quotes ("name":)? |
collapseStringsAfter? | number | 120 | Strings longer than this are truncated and expand on press. 0 disables it. |
groupArraysAfter? | number | 100 | Arrays longer than this are split into [0 … 99] chunks. |
toolbar? | boolean | true | The toolbar on top (search, expand/collapse all, copy). |
search? | boolean | true | Search box in the toolbar. |
copyable? | boolean | true | A "copy value" and "copy path" menu on long-pressing a row, and "copy all" in the toolbar. |
linkify? | boolean | true | Turn strings starting with http(s):// into links? |
onLinkPress? | (url: string) => void | Called when a link is pressed; if omitted the address opens in the system (Linking.openURL). | |
onSelect? | (path: JsonPathSegment[], value: unknown) => void | Called with the path and value when a key is pressed (e.g. to open a detail screen). | |
maxHeight? | number | "none" | 448 | Maximum height of the visible area (pixels, scales with the device); when exceeded it scrolls and only visible rows are drawn. "none" is unlimited (the page's own scrolling is used then). |
label? | string | "JSON"` (`messages.jsonView`) | Screen reader name. |
style? | StyleProp<ViewStyle> | Container style. | |
testID? | string | Test id. |