├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── example ├── css │ └── style.css ├── index.html └── js │ ├── handlers.js │ └── jquery.js ├── package.json ├── resources ├── json-editor.png └── json-editor.svg └── src ├── jquery-json-editor.js └── jquery-json-editor.min.js /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *~ 3 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Developer guidelines 2 | - Function-scoped JavaScript variable declarations (variables declared with 3 | `var`) should always be put at the top of the block. They are visible in the 4 | entire function in which they are declared, but we are anticipating the `let` 5 | block-scoped variables which will be available in the future. When `let` will 6 | become available in the most used browser versions, it will be easier for us 7 | to just replace `var` with `let` because the variable declarations will 8 | already be put in the corresponding block. 9 | - Function declarations, but not definitions, so declarations like `function 10 | f(...) { ... }`, should be put at the top of the block in which they are 11 | declared because they can be called (they are visible) also before their 12 | declaration in that block. (This is the new ES6 behavior. See 13 | [here](http://dev.venntro.com/2013/09/es6-part-2/), 14 | [here](https://bugzilla.mozilla.org/show_bug.cgi?id=585536) and 15 | [here](https://bugs.webkit.org/show_bug.cgi?id=27226).). 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-15 jillix 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | jQuery JSON Editor 2 | ================== 3 | A jQuery library for editing JSON data. 4 | 5 |  6 | 7 | # Documentation 8 | ## `$.fn.jsonEdit(opt_options)` 9 | Initializes the JSON editor on selected elements. 10 | 11 | ### Params 12 | - **Object** `opt_options`: An object containing the following fields: 13 | - `data` (Object): The input JSON data (default: `{}`). 14 | - `schema` (Object): The JSON data schema. The provided object will be merged with default schema. 15 | - `autoInit` (Boolean): If `true`, the forms will be added by default (default: `true`). 16 | 17 | ### Return 18 | - **Object** The JSON editor object containing: 19 | - `labels` (Object): An object with UI elements used for labels. 20 | - `groups` (Object): An object with UI elements used for groups. 21 | - `inputs` (Object): An object with UI elements used for inputs. 22 | - `container` (jQuery): A jQuery object being the container of the JSON editor. 23 | - `createGroup` (Function): Creates a form group. 24 | 25 | ## `createGroup(field)` 26 | Creates a form group and returns the jQuery object. 27 | 28 | ### Params 29 | - **Object** `field`: The field object. 30 | 31 | ### Return 32 | - **jQuery** The jQuery object form. 33 | 34 | ## `addControls(path)` 35 | Adds delete button control. 36 | 37 | ### Params 38 | - **String** `path`: The field path. 39 | 40 | ## `add(path, data)` 41 | Adds new elements in arrays. 42 | 43 | ### Params 44 | - **String|jQuery** `path`: The path to the field or the jQuery object. 45 | - **Object** `data`: Data to add. 46 | 47 | ## `delete(path)` 48 | Deletes elements from arrays. 49 | 50 | ### Params 51 | - **jQuery** `path`: The