Need help with jsoneditor-react?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

vankop
175 Stars 61 Forks MIT License 77 Commits 30 Opened issues

Description

react wrapper implementation for https://github.com/josdejong/jsoneditor

Services available

!
?

Need anything else?

Contributors list

# 2,665
JavaScr...
Markdow...
Applica...
amd
40 commits
# 244,829
HTML
CSS
leaflet...
Shell
2 commits
# 9,682
React N...
Visual ...
TypeScr...
Redux
1 commit
# 130,907
PHP
HTML
Node.js
circle-...
1 commit
# 92,810
Flask
CSS
HTML
reactjs
1 commit

jsoneditor-react

Version Licence Known Vulnerabilities

react wrapper implementation for josdejong/jsoneditor

Installation

npm install --save jsoneditor jsoneditor-react

jsoneditor-react
using minimalist version of
jsoneditor
to minimize flat bundle size, so if you want to use Ajv or Ace Editor install them as well

Bundling

Version

3.0.0
and higher provide only es build. Also you need some loaders (in terms of webpack) to load json editor icons and css, e.g.:
javascript
module.exports = {
  module: {
    rules: [
      {test: /\.css$/, loader: 'css-loader'},
      {test: /\.svg$/, loader: 'file-loader'}
    ]
  }
};

Usage

import { JsonEditor as Editor } from 'jsoneditor-react';
import 'jsoneditor-react/es/editor.min.css';

later in render method:

render() {
    return (
        
    );
}

If you want use with Ajv:

import Ajv from 'ajv';

const ajv = new Ajv({ allErrors: true, verbose: true });

...

render() { return ( ); }

If you want use with Ace Editor:

import ace from 'brace';
import 'brace/mode/json';
import 'brace/theme/github';

...

render() { return ( ); }

Or:

import 'brace';
import 'brace/mode/json';
import 'brace/theme/github';

...

render() { return ( ); }

Or define your own ace theme

Async component

If you using webpack and es6 dynamic imports you can load

jsoneditor-react
asynchronously. You can use react-imported-component or your own implementation
import importedComponent from 'react-imported-component';

const JsonEditor = importedComponent(() => import(/* webpackChunkName:'jsoneditor' */'jsoneditor-react'));

Or with Ajv and Ace Editor:

const JsonEditor = importedComponent(() => Promise.all([
    import(/* webpackChunkName:'jsoneditor' */'jsoneditor-react'),
    import(/* webpackChunkName:'jsoneditor' */'brace'),
    import(/* webpackChunkName:'jsoneditor' */'ajv'),
    import(/* webpackChunkName:'jsoneditor' */'brace/mode/json'),
    import(/* webpackChunkName:'jsoneditor' */'brace/theme/github')
]).then(([{ JsonEditor: Editor }, ace, Ajv ]) => {
    const ajv = new Ajv();
    return function EditorHoc(props) {
        return (
            
        );
    }
}));

Playground

You can view usage of

jsoneditor-react
using our storybook.

Steps to run storybook

  • fork or clone repository
  • npm run dev
  • View
    http://localhost:9001

Right now only one story exporting in storybook:

/stories/Editor.jsx
, to add more use
/.storybook/config.js

Api

Working on

docs
folder. Right now you can use props declaration

Test

Will be soon!😁

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.