jQuery powered JSON editor for basic JSON editing on your web project
Just include src/JSONedtr.css
and src/JSONedtr.js
in your project after jQuery by putting following code into your code
<script src="src/JSONedtr.js"></script>
<link rel="stylesheet" type="text/css" href="src/JSONedtr.css">
<div id="output"></div>
$(document).ready(function(){
var data = '{"first_key":"one","second_key":"two","third_key":{"one":"item 3-1","two":"item 3-2","three":"item 3-3"}}';
new JSONedtr( data, '#output' );
});
<div id="output-1"></div>
<div id="output-2"></div>
$(document).ready(function(){
var data1 = '{"first_key":"one","second_key":"two","third_key":{"one":"item 3-1","two":"item 3-2","three":"item 3-3"}}';
var foo = new JSONedtr( data1, '#output-1' );
var data2 = '{"fourth_key":[1,2,3,4,5],"fifth_key":{"level_2":{"level_3":{"level_4":"item"}}}}';
var bar = new JSONedtr( data2, '#output-2' );
});
<div id="output-1"></div>
<div id="output-2"></div>
$(document).ready(function(){
var data = '{"first_key":"one","second_key":"two","third_key":{"one":"item 3-1","two":"item 3-2","three":"item 3-3"}}';
new JSONedtr( data, '#output' );
// See your output in console (Ctrl+F12)
var result1 = one.getData();
console.log('Output of getData(): ', result1);
var result2 = one.getDataString();
console.log('Output of getDataString(): ', result2);
});
- deleteDisabled (default: false) - If set true you can't remove items
- addDisabled (default: false) - If set true you can't add more items
- editKeyDisabled (default: false) - If set true all key/name-of-property input are disabled
- editValueDisabled (default: false) - If set true all value input are disabled
- careAboutType (default: false) - If set true the processor of get back the date put all value in a string, if set false it try to 'decode' the type of the value and put in the model with the right type (lazy mode)
$(document).ready(function(){
var data = '{"first_key":"one","second_key":"two","third_key":{"one":"item 3-1","two":"item 3-2","three":"item 3-3"}}';
new JSONedtr( data, '#output', {
deleteDisabled: true,
editKeyDisabled: true
});
// See your output in console (Ctrl+F12)
var result1 = one.getData();
console.log('Output of getData(): ', result1);
});
See provided example files and their code for more information
- implement object and array creation from zero
- add different language support
- add support to reference type
- use SASS
dark themeDONE- minify code for production
Please open an issue for support.
New pull requests are encouraged and welcomed.
Please contribute using Github Flow. Create a branch, add commits, and open a pull request.