React JSON View

React JSON View

React component for viewing and editing JSON

Description

The quick way to show an API response in a React page is JSON.stringify inside a pre tag. You get a wall of text, and once the nesting goes deep you can't find the field you need, let alone let users edit it.

React JSON View renders arrays and JSON objects as a collapsible tree with the data type next to every value: string, int, float, bigint, NaN, undefined, Date, Set and Map are all told apart. Collapse depth, indent, quote style and object sizes are each one prop, and nodes can be copied with a click while updated values get highlighted.

MIT licensed and written in TypeScript, with themes and per-type rendering you can customise.

Features



Tree view: collapsible objects and arrays with item counts, and long strings shortened after a set length.

Type labels: string, int, float, bool, null, undefined, Date, url and more shown before each value, with proper display of Set and Map.

Editing: the 2.0 line adds editing values directly in the tree.

Copy and highlight: copy any node to the clipboard and highlight values when data changes.

Themes: several built-in themes, plus an online editor to tune colours and export your own.

Custom rendering: replace how nodes render by type or key, for example showing image URLs as thumbnails.