# Usage ### Install with npm: npm install jsoneditor with bower: bower install jsoneditor download: [http://jsoneditoronline.org/downloads/](http://jsoneditoronline.org/downloads/) The library consists of three files: one javascript file, one css file and an image. Both full and minified version are available. ## Load To implement JSONEditor in a web application, load the javascript and css file in the head of the HTML page: ```html ``` ### Detailed error messages Optionally, [jsonlint](https://github.com/zaach/jsonlint) can be loaded to get more detailed error messages. ```html ``` ### Code editor The mode 'code' requires the [Ace editor](http://ace.ajax.org/) to be loaded. JSON Editor comes with a custom built version of Ace containing the ace modules `ace.js`, `ext-searchbox.js`, `mode-json.js`, `theme-textmate.js`, and a custom theme `theme-jsoneditor.js`. Besides loading ace, the content type must be specified on the page. ```html ``` ## Use In the body, create an div element with an id and a size: ```html
``` After the page is loaded, load the editor with javascript: ```js var container = document.getElementById("jsoneditor"); var options = { mode: 'tree' }; var editor = new JSONEditor(container, options); ``` To set JSON data in the editor: ```js var json = { "Array": [1, 2, 3], "Boolean": true, "Null": null, "Number": 123, "Object": {"a": "b", "c": "d"}, "String": "Hello World" }; editor.set(json); ``` To get JSON data from the editor: ```js var json = editor.get(); ``` ## Full Example ```html

``` For more examples, see the [examples section](https://github.com/josdejong/jsoneditor/tree/master/examples).