v22.18.0 release notes

JsonViewer

JsonViewer shows any JSON value as a read-only, collapsible tree: typed colours, object and array sizes, search with highlighted matches, copy of values and paths, JSON text parsing with a clear error, and large arrays split into pages. It follows the WAI-ARIA tree pattern and has no dependency.

View as .md
import { JsonViewer } from '@exhaustive-ui/core/jsonviewer';

JsonViewer shows the value it is given, any JSON compatible value, as a read-only tree. Strings, numbers, booleans and null have their own colour, and a collapsed object or array shows its size, such as {3 keys} or [2 items]. Click a node, or use the arrow keys, to expand it; hover a node to copy its value or its path.

{8 keys}
id: 1042
name: "Ada Lovelace"
verified: true
manager: null
lastLogin: "2026-11-28T09:41:00Z"

expandDepth sets how many levels are open at first: 0 shows the root collapsed, 1 (the default) shows its children. toolbar adds the Expand all and Collapse all buttons, also available as the expandAll and collapseAll methods, and toggle opens or closes a node by its identifier.

sortKeys sorts the keys of the objects, or takes a compare function. rootName names the root, arrayIndexes hides the indexes of the array items when false, and quoteKeys shows the keys between quotes, as in JSON.

Depth0123
order: {9 keys}
number: "SO-2026-0412"
status: "shipped"
total: 148.9
currency: "EUR"
paid: true
coupon: null

filter adds a search input above the tree. The keys and the values that contain the text, ignoring case, are highlighted and their ancestors expand, the number of matches is shown and announced to screen readers, and the arrow buttons, enter and shift+enter move between the matches. escape clears the search and the down arrow moves the focus to the current match. When the search is cleared, the nodes go back to the state they had before.

With filterMode="filter", the nodes that neither match nor contain a match are hidden. filterValue is two-way bindable, so the search can also come from an input of your own, without the built-in one.

ModeHighlightFilter
1 of 3
{4 keys}
name: "Platform"
members: [4 items]
0: {4 keys}
name: "Ada Lovelace"
role: "Engineer"
office: "London"
3: {4 keys}
name: "Tim Berners-Lee"
role: "Architect"
office: "London"
offices: {3 keys}

Searching for: london

Each node has a copy value and a copy path button, shown on hover and focus, and the focused node is copied with ctrl+c and its path with ctrl+shift+c (⌘ on a Mac). A value is copied as it is for a string and as indented JSON otherwise. A live region announces the copy, the button shows a check mark, and onCopy gives the copied text. copyable turns this off.

pathFormat chooses between a JSONPath such as $.users[2].email (the default), a dot path such as users.2.email, used by lodash get and many form libraries, and a JSON Pointer such as /users/2/email. A click on a node, enter or space emits onNodeSelect with its key, its value and its path.

Path formatJSONPathDotPointer
{2 keys}
page: 1
users: [3 items]
Selected path
none
Last copy
none

Only the expanded nodes are rendered, and the children of an object or an array larger than pageSize (100 by default) are split into groups such as [0 … 99], which expand on demand; very large arrays get groups of groups. This array of 10,000 events opens at once, and the search still finds every match and expands only the groups that contain the first ones. Expand all leaves the groups collapsed.

Strings longer than maxStringLength (200 characters by default, 0 to turn it off) are cut, with a button, or the right arrow, to show them whole. An object that contains itself is shown as [Circular] instead of looping.

{3 keys}
count: 10000

With parse, a string value is read as a JSON text, such as the body of an HTTP response or a field of a form. When it is not valid, the tree is replaced by an error with the message of the browser, the line and the column, and the line itself with the faulty character marked; onParseError gives the same details, and the error template replaces the message. An empty text shows the empty message. Remove the comma after "draft" below to fix it.

Invalid JSON at line 3
Invalid JSON
Unexpected token ']', ...", "draft",], "publ"... is not valid JSON
Line 3, column 31
  "tags": ["angular", "draft",],

The string, number, boolean and null templates replace the rendering of a type, and the value template the types without their own template. They receive the value, its type, its key, its path, the text shown by default and the node, and render inside the element that has the colour of the type. The key template replaces the keys, and the error template the parse error.

Here the URLs become links and the ISO dates are formatted. The tree keeps a single tab stop, so the links are not in the tab sequence: enter on their node opens them, through onNodeSelect.

{9 keys}
name: "exhaustive-ui"
license: "MIT"
private: no
archived: no
createdAt:
pushedAt:
stars: 1280

The colours of the keys and of each type come from the jsonviewer design tokens, with a light and a dark value in the four presets that meet the WCAG AA contrast ratio. Override them for the whole application in the preset, or for one viewer with the dt property, as this viewer does with a palette of its own. The monospace font, the indentation and the highlight of the matches are tokens too: see the Theming tab for the full list.

{6 keys}
name: "checkout"
replicas: 3
autoscale: true
region: null
ports: [2 items]
0: 8080
1: 8443
env: {2 keys}
NODE_ENV: "production"
LOG_LEVEL: "warn"

Screen Reader

The value is shown with the tree view pattern: an element with the tree role, labelled by the tree label, ariaLabel or ariaLabelledBy, and a treeitem for each visible node, with aria-level, aria-posinset and aria-setsize, and aria-expanded on the objects, arrays and groups that can open. Each node is named by its key and its value, such as email: "[email protected]", or the size of an object or an array, and aria-keyshortcuts tells the copy shortcuts.

The tree is a single tab stop: the focused node has tabindex="0" and the others -1. The copy and show more buttons stay out of the tab sequence, reached with the mouse, a screen reader or the keyboard shortcuts, and have their own accessible name. A polite live region announces the copies, a failed copy, and the number of matches once the search text settles.

The search input is labelled by its placeholder, controls the tree with aria-controls and is described by the number of matches. Every text comes from the labels input: the tree name, the search filter, matchCount, matchesAnnouncement and noMatches (the emptySearchMessage of the translation configuration by default), the copyValue and copyPath names, the announcements, the summaries keys, oneKey, items and oneItem, the range of a group and the parse error texts.

<p-json-viewer [value]="data" [labels]="{ tree: 'Réponse', filter: 'Rechercher', copyValue: 'Copier la valeur de {0}', copyPath: 'Copier le chemin de {0}', keys: '{0} clés', items: '{0} éléments' }" filter />

<h2 id="payload-title">Payload</h2>
<p-json-viewer [value]="payload" ariaLabelledBy="payload-title" />

Keyboard Support

KeyFunction
tabMoves the focus into the tree, on the last focused node, or out of it.
down arrow / up arrowMoves the focus to the next or the previous visible node.
right arrowExpands a collapsed node, moves to the first child of an expanded one, or shows the whole of a long string. In right to left layouts, the left arrow does this.
left arrowCollapses an expanded node, or moves to the parent node.
home / endMoves the focus to the first or the last visible node.
enterExpands or collapses the node, and emits onNodeSelect.
spaceEmits onNodeSelect.
*Expands the siblings of the focused node.
CharactersMoves the focus to the next node whose key starts with the typed characters.
ctrl + c / ⌘ + cCopies the value of the focused node, unless some text is selected.
ctrl + shift + c / ⌘ + shift + cCopies the path of the focused node.

Search Input Keyboard Support

KeyFunction
enter / shift + enterMakes the next or the previous match the current one, expanding its ancestors and scrolling it into view.
down arrowMoves the focus to the current match, or to the tree.
escapeClears the search.