json-edit-react
TypeScript icon, indicating that this package has built-in type declarations

1.26.2 • Public • Published

screenshot

A highly-configurable React component for editing or viewing JSON/object data

NPM Version GitHub License NPM Downloads

Features include:

  • Easy inline editing of individual values or whole blocks of JSON text
  • 🔒 Granular control – restrict edits, deletions, or additions per element
  • 📏 JSON Schema validation (using 3rd-party validation library)
  • 🎨 Customisable UI — built-in or custom themes, CSS overrides or targeted classes
  • 📦 Self-contained — plain HTML/CSS, so no dependence on external UI libraries
  • 🔍 Search & filter — find data by key, value or custom function
  • 🚧 Custom components — replace specific nodes with specialised components (e.g. date picker, links, images, undefined, BigInt, Symbol)
  • 🌏 Localisation — easily translate UI labels and messages
  • 🔄 Drag-n-drop re-ordering within objects/arrays
  • 🎹 Keyboard customisation — define your own key bindings
  • 🎮 External control via callbacks and triggers

💡 Try the Live Demo to see these features in action!

screenshot

breaking changes

Installation

# Depending on your package manager:

npm i json-edit-react
# OR
yarn add json-edit-react

Implementation

import { JsonEditor } from 'json-edit-react'

// In your React component:
return (
  <JsonEditor
    data={ jsonData }
    setData={ setJsonData } // optional
    { ...otherProps } />
);

Usage

(for end user)

It's pretty self explanatory (click the "edit" icon to edit, etc.), but there are a few not-so-obvious ways of interacting with the editor:

  • Double-click a value (or a key) to edit it
  • When editing a string, use Cmd/Ctrl/Shift-Enter to add a new line (Enter submits the value)
  • It's the opposite when editing a full object/array node (which you do by clicking "edit" on an object or array value) — Enter for new line, and Cmd/Ctrl/Shift-Enter for submit
  • Escape to cancel editing
  • When clicking the "clipboard" icon, holding down Cmd/Ctrl will copy the path to the selected node rather than its value
  • When opening/closing a node, hold down "Alt/Option" to open/close all child nodes at once
  • For Number inputs, arrow-up and down keys will increment/decrement the value
  • For Boolean inputs, space bar will toggle the value
  • Easily navigate to the next or previous node for editing using the Tab/Shift-Tab keys.
  • Drag and drop items to change the structure or modify display order
  • When editing is not permitted, double-clicking a string value will expand the text to the full value if it is truncated due to length (there is also a clickable "..." for long strings)
  • JSON text input can accept "looser" input, if an additional JSON parsing method is provided (e.g. JSON5). See jsonParse prop.

Have a play with the Demo app to get a feel for it!


For FULL DOCUMENTATION, visit https://github.com/CarlosNZ/json-edit-react

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.26.217,935latest

Version History

VersionDownloads (Last 7 Days)Published
1.26.217,935
1.26.1852
1.26.0765
1.25.61,422
1.25.6-beta31
1.25.6-beta22
1.25.6-beta11
1.25.5517
1.25.43
1.25.316,937
1.25.2-beta11
1.25.1137
1.25.05,488
1.25.0-beta11
1.24.01,236
1.23.14,848
1.23.01,579
1.22.61,689
1.22.50
1.22.40
1.22.2426
1.22.1892
1.22.01,634
1.21.2721
1.20.078
1.19.210,780
1.19.1953
1.19.020
1.19.0-beta10
1.18.0301
1.18.0-beta11
1.17.34,392
1.17.21
1.17.111,141
1.17.01,529
1.16.3570
1.16.02
1.15.127
1.15.11228
1.15.10138
1.15.10-rc14
1.15.9440
1.15.81
1.15.731
1.15.5116
1.15.4279
1.15.347
1.15.2189
1.15.013
1.14.1326
1.14.07
1.13.3311
1.13.2106
1.13.147
1.12.0120
1.12.0-rc113
1.11.916
1.11.874
1.11.7116
1.11.615
1.11.31
1.11.0459
1.10.20
1.9.31,577
1.9.211
1.9.135
1.9.016
1.8.41
1.8.21
1.8.17
1.8.00
1.7.20
1.7.00
1.6.12
1.6.00
1.5.30
1.5.10
1.5.00
1.4.20
1.4.00
1.3.21
1.3.00
1.2.50
1.2.40
1.2.21
1.2.00
1.1.30
1.1.12,358
1.1.00
1.0.00
0.9.63
0.9.40
0.9.30
0.9.10
0.9.00

Package Sidebar

Install

npm i json-edit-react

Weekly Downloads

94,587

Version

1.26.2

License

MIT

Unpacked Size

138 kB

Total Files

10

Last publish

Collaborators

  • carlosnz