jsoneditor-react vs jsoneditor vs react-json-editor-ajrm vs react-json-view vs react-jsonschema-form
JSON Editing Libraries for React
jsoneditor-reactjsoneditorreact-json-editor-ajrmreact-json-viewreact-jsonschema-formSimilar Packages:

JSON Editing Libraries for React

These libraries provide various functionalities for editing, viewing, and managing JSON data in web applications. They cater to different needs, from simple viewing to complex schema-based forms, making it easier for developers to integrate JSON handling capabilities into their React applications.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
jsoneditor-react38,57327665 kB44-MIT
jsoneditor012,2138.2 MB2297 days agoApache-2.0
react-json-editor-ajrm0364350 kB13 years agoMIT
react-json-view03,661-1915 years agoMIT
react-jsonschema-form015,732-1996 years agoApache-2.0

Feature Comparison: jsoneditor-react vs jsoneditor vs react-json-editor-ajrm vs react-json-view vs react-jsonschema-form

Editing Capabilities

  • jsoneditor-react:

    jsoneditor-react inherits all editing capabilities from jsoneditor, providing a React-friendly interface. It allows for interactive editing of JSON data with real-time validation, making it easy to integrate into any React application.

  • jsoneditor:

    jsoneditor offers a comprehensive set of editing tools, including tree and text views, allowing users to manipulate JSON data easily. It supports features like drag-and-drop for reordering elements, and it provides validation feedback to ensure the JSON structure is correct.

  • react-json-editor-ajrm:

    react-json-editor-ajrm provides a simple editing interface focused on JSON objects and arrays. It allows users to edit JSON data directly in a user-friendly manner, but lacks advanced features like drag-and-drop or validation feedback.

  • react-json-view:

    react-json-view is primarily for viewing JSON data rather than editing it. It allows users to expand and collapse JSON structures for better readability, but does not provide editing capabilities, making it unsuitable for applications that require JSON manipulation.

  • react-jsonschema-form:

    react-jsonschema-form allows users to edit JSON data through dynamically generated forms based on JSON Schema. It provides a structured way to edit data, with built-in validation, but is not a general-purpose JSON editor.

Integration with React

  • jsoneditor-react:

    jsoneditor-react is specifically designed for React, providing a seamless integration experience. It allows developers to use the jsoneditor library as a React component, making it easier to manage state and lifecycle events within a React application.

  • jsoneditor:

    jsoneditor is a standalone library and does not have built-in support for React. It requires manual integration, which may involve handling lifecycle methods and state management separately.

  • react-json-editor-ajrm:

    react-json-editor-ajrm is tailored for React applications, providing a simple API to integrate JSON editing capabilities directly into React components. It leverages React's state management, making it easy to handle changes and updates.

  • react-json-view:

    react-json-view is a React component that displays JSON data in a structured format. It integrates well with React applications, allowing developers to easily visualize JSON data without additional setup.

  • react-jsonschema-form:

    react-jsonschema-form is built for React and utilizes JSON Schema to generate forms. It integrates smoothly with React's state management and lifecycle methods, making it ideal for applications that require dynamic form generation.

Complexity and Learning Curve

  • jsoneditor-react:

    jsoneditor-react has a lower learning curve for React developers since it wraps the jsoneditor library in a React component. Familiarity with React concepts will make it easier to use this package.

  • jsoneditor:

    jsoneditor has a moderate learning curve due to its extensive features and standalone nature. Developers need to familiarize themselves with its API and how to integrate it into their applications effectively.

  • react-json-editor-ajrm:

    react-json-editor-ajrm is designed to be simple and intuitive, making it easy for developers to get started with JSON editing in React. Its lightweight nature contributes to a gentle learning curve.

  • react-json-view:

    react-json-view is straightforward to use, focusing on displaying JSON data rather than editing it. Developers can quickly implement it in their applications without much overhead.

  • react-jsonschema-form:

    react-jsonschema-form may have a steeper learning curve due to its reliance on JSON Schema for form generation. Developers need to understand JSON Schema concepts to effectively use this library.

Use Cases

  • jsoneditor-react:

    jsoneditor-react is suitable for React applications where a rich JSON editing experience is needed, such as admin dashboards or data entry forms that require user interaction with JSON data.

  • jsoneditor:

    jsoneditor is ideal for applications that require robust JSON editing capabilities, such as data management tools, configuration editors, or any application where users need to manipulate JSON data directly.

  • react-json-editor-ajrm:

    react-json-editor-ajrm is best for lightweight applications that need basic JSON editing features, such as simple data entry forms or educational tools that allow users to experiment with JSON.

  • react-json-view:

    react-json-view is perfect for applications that need to display JSON data in a user-friendly manner, such as API response viewers or debugging tools that visualize complex data structures.

  • react-jsonschema-form:

    react-jsonschema-form is designed for applications that require dynamic forms based on structured data, such as survey applications or any form-driven interface that needs to adapt to different data schemas.

Customization and Extensibility

  • jsoneditor-react:

    jsoneditor-react inherits customization capabilities from jsoneditor, allowing developers to adjust the component's appearance and functionality while leveraging React's props and state management.

  • jsoneditor:

    jsoneditor offers various customization options, allowing developers to style the editor and modify its behavior through configuration options. However, extensive customization may require deeper knowledge of the library.

  • react-json-editor-ajrm:

    react-json-editor-ajrm provides limited customization options, focusing on simplicity. Developers can adjust basic styles but may find it restrictive for more complex requirements.

  • react-json-view:

    react-json-view is customizable in terms of styling and behavior, allowing developers to modify how JSON data is displayed. However, it does not support editing, limiting its extensibility for interactive applications.

  • react-jsonschema-form:

    react-jsonschema-form is highly customizable, allowing developers to define custom widgets and validation rules. This makes it suitable for applications that require tailored form experiences based on user needs.

How to Choose: jsoneditor-react vs jsoneditor vs react-json-editor-ajrm vs react-json-view vs react-jsonschema-form

  • jsoneditor-react:

    Opt for jsoneditor-react if you want to integrate the jsoneditor library seamlessly into a React application. This package wraps the jsoneditor library, allowing you to use it as a React component while maintaining the same features and functionality of jsoneditor.

  • jsoneditor:

    Choose jsoneditor if you need a standalone library that provides a rich, interactive interface for editing JSON data with features like tree view, text view, and validation. It is suitable for applications requiring a comprehensive JSON editing experience without being tied to React.

  • react-json-editor-ajrm:

    Select react-json-editor-ajrm if you need a simple and lightweight JSON editor that is specifically designed for React. It provides a straightforward interface for editing JSON objects and arrays, making it ideal for applications that require basic JSON editing capabilities without additional complexity.

  • react-json-view:

    Use react-json-view when you need a library focused on displaying JSON data in a structured and readable format. It allows for expandable and collapsible views of JSON objects, making it perfect for applications that need to visualize JSON data rather than edit it directly.

  • react-jsonschema-form:

    Choose react-jsonschema-form if you are building forms based on JSON Schema. This library automatically generates forms from a JSON Schema definition, making it suitable for applications that require dynamic form generation and validation based on structured data.

README for jsoneditor-react

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.:

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 (
        <Editor
            value={yourJson}
            onChange={this.handleChange}
        />
    );
}

If you want use with Ajv:

import Ajv from 'ajv';

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

...

render() {
    return (
        <Editor
            value={yourJson}
            onChange={this.handleChange}
            ajv={ajv}
            schema={yourSchema}
        />
    );
}

If you want use with Ace Editor:

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

...

render() {
    return (
        <Editor
            value={yourJson}
            onChange={this.handleChange}
            ace={ace}
            theme="ace/theme/github"
            schema={yourSchema}
        />
    );
}

Or:

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

...

render() {
    return (
        <Editor
            value={yourJson}
            onChange={this.handleChange}
            theme="ace/theme/github"
            schema={yourSchema}
        />
    );
}

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 (
            <Editor
                ace={ace}
                ajv={ajv}
                theme="ace/theme/github"
                {...props}
            />
        );
    }
}));

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!๐Ÿ˜