JSON editor.
https://luna.liriliri.io/?path=/story/json-editor
Add the following script and style to your page.
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/luna-json-editor/luna-json-editor.css" />
<script src="//cdn.jsdelivr.net/npm/luna-json-editor/luna-json-editor.js"></script>
You can also get it on npm.
npm install luna-json-editor --save
import 'luna-json-editor/luna-json-editor.css'
import LunaJsonEditor from 'luna-json-editor'
const container = document.getElementById('container')
const jsonEditor = new LunaJsonEditor(container, {
name: 'luna',
value: {
a: true,
},
nameEditable: false,
})
jsonEditor.expand(true)
- enableDelete(boolean): Enable deletion.
- enableInsert(boolean): Enable insertion.
- name(any): Object name.
- nameEditable(boolean): Is name editable.
- showName(boolean): Show object name or not.
- valueEditable(boolean): Is value editable.
Expand object.