jsoneditor
A web-based tool to view, edit, format, and validate JSON
Last updated 4 years ago by josdejong .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install jsoneditor 
SYNC missed versions from official npm registry.

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, Opera, Edge, Internet Explorer 11.

json editor   code editor

Cross browser testing for JSONEditor is generously provided by BrowserStack

BrowserStack

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

Note that to use JSONEditor in Internet Explorer 11, it is necessary to load a polyfill for Promise in your application.

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

Custom builds

The source code of JSONEditor consists of CommonJS modules. JSONEditor can be bundled in a customized way using a module bundler like browserify or webpack. First, install all dependencies of jsoneditor:

npm install

To create a custom bundle of the source code using browserify:

browserify ./index.js -o ./jsoneditor.custom.js -s JSONEditor

The Ace editor, used in mode code, accounts for about one third of the total size of the library. To exclude the Ace editor from the bundle:

browserify ./index.js -o ./jsoneditor.custom.js -s JSONEditor -x brace -x brace/mode/json -x brace/ext/searchbox

To minify the generated bundle, use uglifyjs:

uglifyjs ./jsoneditor.custom.js -o ./jsoneditor.custom.min.js -m -c

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.

Current Tags

  • 9.10.0                                ...           latest (2 years ago)

197 Versions

  • 9.10.0                                ...           2 years ago
  • 9.9.2                                ...           2 years ago
  • 9.9.1                                ...           2 years ago
  • 9.9.0                                ...           2 years ago
  • 9.8.0                                ...           3 years ago
  • 9.7.4                                ...           3 years ago
  • 9.7.3                                ...           3 years ago
  • 9.7.2                                ...           3 years ago
  • 9.7.1                                ...           3 years ago
  • 9.7.0                                ...           3 years ago
  • 9.6.0                                ...           3 years ago
  • 9.5.11                                ...           3 years ago
  • 9.5.10                                ...           3 years ago
  • 9.5.9                                ...           3 years ago
  • 9.5.8                                ...           3 years ago
  • 9.5.7                                ...           3 years ago
  • 9.5.6                                ...           3 years ago
  • 9.5.5                                ...           3 years ago
  • 9.5.4                                ...           3 years ago
  • 9.5.3                                ...           3 years ago
  • 9.5.2                                ...           3 years ago
  • 9.5.1                                ...           3 years ago
  • 9.5.0                                ...           3 years ago
  • 9.4.2                                ...           4 years ago
  • 9.4.1                                ...           4 years ago
  • 9.4.0                                ...           4 years ago
  • 9.3.1                                ...           4 years ago
  • 9.3.0                                ...           4 years ago
  • 9.2.0                                ...           4 years ago
  • 9.1.10                                ...           4 years ago
  • 9.1.9                                ...           4 years ago
  • 9.1.8                                ...           4 years ago
  • 9.1.7                                ...           4 years ago
  • 9.1.6                                ...           4 years ago
  • 9.1.5                                ...           4 years ago
  • 9.1.4                                ...           4 years ago
  • 9.1.3                                ...           4 years ago
  • 9.1.2                                ...           4 years ago
  • 9.1.1                                ...           4 years ago
  • 9.1.0                                ...           4 years ago
  • 9.0.5                                ...           4 years ago
  • 9.0.4                                ...           4 years ago
  • 9.0.3                                ...           4 years ago
  • 9.0.2                                ...           4 years ago
  • 9.0.1                                ...           4 years ago
  • 9.0.0                                ...           5 years ago
  • 8.6.8                                ...           5 years ago
  • 8.6.7                                ...           5 years ago
  • 8.6.6                                ...           5 years ago
  • 8.6.5                                ...           5 years ago
  • 8.6.4                                ...           5 years ago
  • 8.6.3                                ...           5 years ago
  • 8.6.2                                ...           5 years ago
  • 8.6.1                                ...           5 years ago
  • 8.6.0                                ...           5 years ago
  • 8.5.3                                ...           5 years ago
  • 8.5.2                                ...           5 years ago
  • 8.5.1                                ...           5 years ago
  • 8.5.0                                ...           5 years ago
  • 8.4.1                                ...           5 years ago
  • 8.4.0                                ...           5 years ago
  • 8.3.0                                ...           5 years ago
  • 8.2.1                                ...           5 years ago
  • 8.2.0                                ...           5 years ago
  • 8.1.2                                ...           5 years ago
  • 8.1.1                                ...           5 years ago
  • 8.1.0                                ...           5 years ago
  • 8.0.0                                ...           5 years ago
  • 7.5.0                                ...           5 years ago
  • 7.4.0                                ...           5 years ago
  • 7.3.1                                ...           5 years ago
  • 7.3.0                                ...           5 years ago
  • 7.2.1                                ...           5 years ago
  • 7.2.0                                ...           5 years ago
  • 7.1.0                                ...           5 years ago
  • 7.0.5                                ...           5 years ago
  • 7.0.4                                ...           5 years ago
  • 7.0.3                                ...           5 years ago
  • 7.0.2                                ...           5 years ago
  • 7.0.1                                ...           5 years ago
  • 7.0.0                                ...           5 years ago
  • 6.4.1                                ...           5 years ago
  • 6.4.0                                ...           5 years ago
  • 6.3.0                                ...           5 years ago
  • 6.2.1                                ...           5 years ago
  • 6.2.0                                ...           5 years ago
  • 6.1.0                                ...           5 years ago
  • 6.0.0                                ...           5 years ago
  • 5.34.0                                ...           5 years ago
  • 5.33.0                                ...           6 years ago
  • 5.32.5                                ...           6 years ago
  • 5.32.4                                ...           6 years ago
  • 5.32.3                                ...           6 years ago
  • 5.32.2                                ...           6 years ago
  • 5.32.1                                ...           6 years ago
  • 5.32.0                                ...           6 years ago
  • 5.31.1                                ...           6 years ago
  • 5.31.0                                ...           6 years ago
  • 5.30.0                                ...           6 years ago
  • 5.29.1                                ...           6 years ago
  • 5.29.0                                ...           6 years ago
  • 5.28.2                                ...           6 years ago
  • 5.28.1                                ...           6 years ago
  • 5.28.0                                ...           6 years ago
  • 5.27.1                                ...           6 years ago
  • 5.27.0                                ...           6 years ago
  • 5.26.3                                ...           6 years ago
  • 5.26.2                                ...           6 years ago
  • 5.26.1                                ...           6 years ago
  • 5.26.0                                ...           6 years ago
  • 5.25.0                                ...           6 years ago
  • 5.24.7                                ...           6 years ago
  • 5.24.6                                ...           6 years ago
  • 5.24.5                                ...           6 years ago
  • 5.24.4                                ...           6 years ago
  • 5.24.3                                ...           6 years ago
  • 5.24.2                                ...           6 years ago
  • 5.24.1                                ...           6 years ago
  • 5.24.0                                ...           6 years ago
  • 5.23.1                                ...           6 years ago
  • 5.23.0                                ...           6 years ago
  • 5.22.0                                ...           6 years ago
  • 5.21.0                                ...           6 years ago
  • 5.20.0                                ...           6 years ago
  • 5.19.2                                ...           6 years ago
  • 5.19.1                                ...           6 years ago
  • 5.19.0                                ...           6 years ago
  • 5.18.0                                ...           6 years ago
  • 5.17.1                                ...           7 years ago
  • 5.17.0                                ...           7 years ago
  • 5.16.0                                ...           7 years ago
  • 5.14.1                                ...           7 years ago
  • 5.14.0                                ...           7 years ago
  • 5.13.3                                ...           7 years ago
  • 5.13.2                                ...           7 years ago
  • 5.13.1                                ...           7 years ago
  • 5.13.0                                ...           7 years ago
  • 5.12.0                                ...           7 years ago
  • 5.11.0                                ...           7 years ago
  • 5.10.1                                ...           7 years ago
  • 5.10.0                                ...           7 years ago
  • 5.9.6                                ...           7 years ago
  • 5.9.5                                ...           7 years ago
  • 5.9.4                                ...           7 years ago
  • 5.9.3                                ...           7 years ago
  • 5.9.2                                ...           7 years ago
  • 5.9.1                                ...           7 years ago
  • 5.9.0                                ...           7 years ago
  • 5.8.2                                ...           7 years ago
  • 5.8.1                                ...           7 years ago
  • 5.8.0                                ...           7 years ago
  • 5.7.2                                ...           7 years ago
  • 5.7.1                                ...           7 years ago
  • 5.7.0                                ...           8 years ago
  • 5.6.0                                ...           8 years ago
  • 5.5.11                                ...           8 years ago
  • 5.5.10                                ...           8 years ago
  • 5.5.9                                ...           8 years ago
  • 5.5.8                                ...           8 years ago
  • 5.5.7                                ...           8 years ago
  • 5.5.6                                ...           8 years ago
  • 5.5.5                                ...           9 years ago
  • 5.5.4                                ...           9 years ago
  • 5.5.3                                ...           9 years ago
  • 5.5.2                                ...           9 years ago
  • 5.5.1                                ...           9 years ago
  • 5.5.0                                ...           9 years ago
  • 5.4.0                                ...           9 years ago
  • 5.3.0                                ...           9 years ago
  • 5.2.0                                ...           9 years ago
  • 5.1.5                                ...           9 years ago
  • 5.1.4                                ...           9 years ago
  • 5.1.3                                ...           9 years ago
  • 5.1.2                                ...           9 years ago
  • 5.1.1                                ...           9 years ago
  • 5.0.1                                ...           9 years ago
  • 5.0.0                                ...           9 years ago
  • 4.2.1                                ...           9 years ago
  • 4.2.0                                ...           10 years ago
  • 4.1.3                                ...           10 years ago
  • 4.1.2                                ...           10 years ago
  • 4.1.1                                ...           10 years ago
  • 4.1.0                                ...           10 years ago
  • 4.0.0                                ...           10 years ago
  • 3.2.0                                ...           10 years ago
  • 3.1.2                                ...           10 years ago
  • 3.1.1                                ...           10 years ago
  • 3.1.0                                ...           10 years ago
  • 3.0.0                                ...           11 years ago
  • 2.3.6                                ...           11 years ago
  • 2.3.5                                ...           11 years ago
  • 2.3.3                                ...           11 years ago
  • 2.3.1                                ...           11 years ago
  • 2.3.0                                ...           11 years ago
  • 2.2.2                                ...           11 years ago
  • 2.2.1                                ...           12 years ago
  • 2.2.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (8)
Dev Dependencies (19)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org | Home |