jsoneditor vs jsoneditor-react vs react-json-editor-ajrm vs react-json-tree vs react-json-view vs react-jsonschema-form
JSON Editing and Visualization Libraries
jsoneditorjsoneditor-reactreact-json-editor-ajrmreact-json-treereact-json-viewreact-jsonschema-formSimilar Packages:

JSON Editing and Visualization Libraries

JSON editing and visualization libraries in JavaScript provide tools for displaying, editing, and manipulating JSON (JavaScript Object Notation) data in a user-friendly manner. These libraries are particularly useful for applications that require users to interact with structured data, such as configuration files, form data, or API responses. They often include features like tree views, inline editing, validation, and support for complex data types, making it easier for users to understand and modify JSON data. Examples include jsoneditor, react-json-view, and react-jsonschema-form, each offering unique functionalities tailored to different use cases.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
jsoneditor012,2088.2 MB2315 months agoApache-2.0
jsoneditor-react027765 kB44-MIT
react-json-editor-ajrm0365350 kB13 years agoMIT
react-json-tree014,35063.2 kB227a year agoMIT
react-json-view03,664-1915 years agoMIT
react-jsonschema-form015,712-2006 years agoApache-2.0

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

Editing Capabilities

  • jsoneditor:

    jsoneditor provides comprehensive editing capabilities, allowing users to edit JSON data both in a tree view and a text editor. It supports inline editing, drag-and-drop for reordering, and even adding or removing nodes, making it highly interactive and flexible.

  • jsoneditor-react:

    jsoneditor-react inherits the full editing capabilities of the jsoneditor library, providing a React-friendly interface for all its features. This includes tree and text editing, inline modifications, and support for complex data structures, ensuring a seamless editing experience in React applications.

  • react-json-editor-ajrm:

    react-json-editor-ajrm focuses on providing a simple editing interface with inline editing capabilities. It supports validation and error highlighting, but it is more lightweight and does not offer as many advanced features as jsoneditor, making it easier to use for quick edits.

  • react-json-tree:

    react-json-tree is primarily a visualization library and does not support editing JSON data. It excels at displaying data in a tree format, allowing users to explore the structure of JSON objects, but it does not provide any functionality for modifying the data.

  • react-json-view:

    react-json-view offers inline editing capabilities for JSON data, allowing users to edit values directly within the tree structure. It supports collapsible nodes and provides a user-friendly interface for both viewing and editing JSON data, making it more interactive than traditional viewers.

  • react-jsonschema-form:

    react-jsonschema-form is not an editing tool for JSON data per se, but rather a form generator that creates interactive forms based on JSON Schema definitions. Users can input data through the generated forms, which are then validated and structured according to the schema, facilitating data entry rather than direct editing of JSON.

Visualization Features

  • jsoneditor:

    jsoneditor includes visualization features such as a tree view and a text representation of JSON data. It allows users to switch between views, providing a clear understanding of the data structure while editing.

  • jsoneditor-react:

    jsoneditor-react provides the same visualization features as jsoneditor, including tree and text views, but optimized for React applications. It allows for smooth integration and rendering of JSON data within React components.

  • react-json-editor-ajrm:

    react-json-editor-ajrm offers basic visualization of JSON data alongside its editing capabilities. It displays the data in a structured format, but its primary focus is on editing rather than advanced visualization.

  • react-json-tree:

    react-json-tree specializes in visualizing JSON data in a tree format. It provides customizable styling, collapsible nodes, and the ability to highlight specific parts of the data, making it an excellent choice for detailed visualization.

  • react-json-view:

    react-json-view provides a rich visualization of JSON data with collapsible nodes, syntax highlighting, and support for custom styling. It is designed for both viewing and editing, making it versatile for various use cases.

  • react-jsonschema-form:

    react-jsonschema-form visualizes JSON Schema data by generating forms based on the schema structure. While it does not visualize JSON data directly, it provides a structured way to input and display data according to the defined schema.

Integration with React

  • jsoneditor:

    jsoneditor is a standalone library that can be integrated into any web application, including those built with React. However, it does not provide React-specific features or optimizations out of the box.

  • jsoneditor-react:

    jsoneditor-react is specifically designed for React applications, providing a React wrapper around the jsoneditor library. It handles component lifecycle methods and props, making it easier to use within React projects.

  • react-json-editor-ajrm:

    react-json-editor-ajrm is built for React and provides a simple API for integrating the JSON editor into React applications. It is lightweight and easy to use, making it a good choice for projects that require a straightforward React component.

  • react-json-tree:

    react-json-tree is a React component for displaying JSON data in a tree format. It is designed to be easily integrated into React applications and allows for customization through props and styling.

  • react-json-view:

    react-json-view is a React component that displays JSON data with inline editing capabilities. It is designed for easy integration into React applications and supports customization through props, making it flexible for various use cases.

  • react-jsonschema-form:

    react-jsonschema-form is a React-based library that generates forms from JSON Schema. It is fully integrated with React and provides a declarative way to create forms, handle validation, and manage form state.

Code Examples

  • jsoneditor:

    Basic Usage of jsoneditor

    <!DOCTYPE html>
    <html>
    <head>
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/9.5.0/jsoneditor.min.css" />
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/9.5.0/jsoneditor.min.js"></script>
        <style>
            #jsoneditor { width: 100%; height: 400px; }
        </style>
    </head>
    <body>
        <div id="jsoneditor"></div>
        <script>
            const container = document.getElementById('jsoneditor');
            const options = { mode: 'tree' };
            const editor = new JSONEditor(container, options);
            const json = { name: "John", age: 30, city: "New York" };
            editor.set(json);
        </script>
    </body>
    </html>
    
  • jsoneditor-react:

    Basic Usage of jsoneditor-react

    import React from 'react';
    import { JsonEditor } from 'jsoneditor-react';
    import 'jsoneditor-react/es/styles/standalone.css';
    
    const App = () => {
        const json = { name: "John", age: 30, city: "New York" };
        return <JsonEditor json={json} />;
    };
    
    export default App;
    
  • react-json-editor-ajrm:

    Basic Usage of react-json-editor-ajrm

    import React from 'react';
    import { JsonEditor } from 'react-json-editor-ajrm';
    import locale from 'react-json-editor-ajrm/locale/en';
    
    const App = () => {
        const json = { name: "John", age: 30, city: "New York" };
        return <JsonEditor locale={locale} json={json} />;
    };
    
    export default App;
    
  • react-json-tree:

    Basic Usage of react-json-tree

    import React from 'react';
    import { JsonTree } from 'react-json-tree';
    
    const data = { name: "John", age: 30, city: "New York" };
    const theme = {
        scheme: 'monokai',
        author: 'Wimer Hazenberg',
        base00: '#272822',
        base01: '#383830',
        base02: '#49483e',
        base03: '#75715e',
        base04: '#f8f8f2',
        base05: '#f8f8f2',
        base06: '#f8f8f2',
        base07: '#f8f8f2',
        base08: '#f92672',
        base09: '#fd971f',
        base0A: '#f4bf75',
        base0B: '#a6e22e',
        base0C: '#a1efe4',
        base0D: '#66d9ef',
        base0E: '#ae81ff',
        base0F: '#cc6633',
    };
    
    const App = () => <JsonTree data={data} theme={theme} />;
    
    export default App;
    
  • react-json-view:

    Basic Usage of react-json-view

    import React from 'react';
    import ReactJson from 'react-json-view';
    
    const data = { name: "John", age: 30, city: "New York" };
    
    const App = () => <ReactJson src={data} theme="monokai" />;
    
    export default App;
    
  • react-jsonschema-form:

    Basic Usage of react-jsonschema-form

    import React from 'react';
    import Form from '@rjsf/core';
    
    const schema = {
        title: "A simple form",
        type: "object",
        properties: {
            name: { type: "string", title: "Name", default: "John" },
            age: { type: "integer", title: "Age", default: 30 },
        },
    };
    
    const App = () => <Form schema={schema} />;
    
    export default App;
    

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

  • jsoneditor:

    Choose jsoneditor if you need a versatile, standalone library for both viewing and editing JSON data in a web application. It provides a rich set of features, including a tree view, text editor, and support for complex data types, making it suitable for a wide range of applications.

  • jsoneditor-react:

    Select jsoneditor-react if you are building a React application and want to integrate the jsoneditor library seamlessly. This package provides a React wrapper around jsoneditor, allowing you to leverage its features while maintaining a React-friendly API and lifecycle management.

  • react-json-editor-ajrm:

    Opt for react-json-editor-ajrm if you need a simple and lightweight JSON editor for React applications. It focuses on providing a clean and intuitive interface for editing JSON data, with support for validation and error handling, making it ideal for projects that require a straightforward editing solution without excessive complexity.

  • react-json-tree:

    Use react-json-tree when you want to display JSON data in a tree format with support for custom styling and interactive features. This library is great for visualizing JSON structures, and it allows for customization of how data is presented, making it suitable for applications that need to highlight specific data or provide a more engaging viewing experience.

  • react-json-view:

    Choose react-json-view if you need a React component for displaying JSON data with features like collapsible nodes, inline editing, and customizable styling. It is particularly useful for debugging and presenting JSON data in a clear and interactive way, allowing users to explore the data structure easily.

  • react-jsonschema-form:

    Select react-jsonschema-form if you are working with JSON Schema and need a library to generate forms dynamically based on schema definitions. This package is ideal for applications that require structured data input, as it automatically handles validation, rendering, and data binding according to the provided JSON Schema.

README for jsoneditor

JSON Editor

Version Downloads Maintenance License FOSSA Status

JSON Editor is a web-based tool to view, edit, format, and validate JSON. It has various modes such as a tree editor, a code editor, and a plain text editor. The editor can be used as a component in your own web application. It can be loaded as CommonJS module, AMD module, or as a regular javascript file.

The library was originally developed as core component of the popular web application https://jsoneditoronline.org and has been open sourced since then.

Supported browsers: Chrome, Firefox, Safari, Edge.

json editor   code editor

Continuous integration tests are run on GitHub Actions, and LambdaTest is used to test on all major browsers.

LambdaTest

Thanks, GitHub Actions and LambdaTest for the generous support for this open source project!

Successor: svelte-jsoneditor

This library jsoneditor has a successor: svelte-jsoneditor. The new editor is not a one-to-one replacement, so there may be reasons to stick with jsoneditor. The main differences between the two are described here.

Features

JSONEditor has various modes, with the following features.

Tree mode

  • Change, add, move, remove, and duplicate fields and values.
  • Sort arrays and objects.
  • Transform JSON using JMESPath queries.
  • Colorized code.
  • Color picker.
  • Search & highlight text in the tree view.
  • Undo and redo all actions.
  • JSON schema validation (powered by ajv).

Code mode

  • Colorized code (powered by Ace).
  • Inspect JSON (powered by Ace).
  • Format and compact JSON.
  • Repair JSON.
  • JSON schema validation (powered by ajv).

Text mode

  • Format and compact JSON.
  • Repair JSON.
  • JSON schema validation (powered by ajv).

Preview mode

  • Handle large JSON documents up to 500 MiB.
  • Transform JSON using JMESPath queries.
  • Format and compact JSON.
  • Repair JSON.
  • JSON schema validation (powered by ajv).

Documentation

Install

with npm (recommended):

npm install jsoneditor

Alternatively, you can use another JavaScript package manager like https://yarnpkg.com/, or a CDN such as https://cdnjs.com/ or https://www.jsdelivr.com/.

Use

Note that in the following example, you'll have to change the urls jsoneditor/dist/jsoneditor.min.js and jsoneditor/dist/jsoneditor.min.css to match the place where you've downloaded the library, or fill in the URL of the CDN you're using.

<!DOCTYPE HTML>
<html lang="en">
<head>
    <!-- when using the mode "code", it's important to specify charset utf-8 -->
    <meta charset="utf-8">

    <link href="jsoneditor/dist/jsoneditor.min.css" rel="stylesheet" type="text/css">
    <script src="jsoneditor/dist/jsoneditor.min.js"></script>
</head>
<body>
    <div id="jsoneditor" style="width: 400px; height: 400px;"></div>

    <script>
        // create the editor
        const container = document.getElementById("jsoneditor")
        const options = {}
        const editor = new JSONEditor(container, options)

        // set json
        const initialJson = {
            "Array": [1, 2, 3],
            "Boolean": true,
            "Null": null,
            "Number": 123,
            "Object": {"a": "b", "c": "d"},
            "String": "Hello World"
        }
        editor.set(initialJson)

        // get json
        const updatedJson = editor.get()
    </script>
</body>
</html>

Build

The code of the JSON Editor is located in the folder ./src. To build jsoneditor:

  • Install dependencies:

    npm install
    
  • Build JSON Editor:

    npm run build
    

    This will generate the files ./jsoneditor.js, ./jsoneditor.css, and
    minified versions in the dist of the project.

  • To automatically build when a source file has changed:

    npm start
    

    This will update ./jsoneditor.js and ./jsoneditor.css in the dist folder on every change, but it will NOT update the minified versions as that's an expensive operation.

Test

Run unit tests:

npm test

Run code linting (JavaScript Standard Style):

npm run lint

License

jsoneditor is released as open source under the permissive the Apache 2.0 license.

If you are using jsoneditor commercially, there is a social (but no legal) expectation that you help fund its maintenance. Start here.