How to use the jsoneditor function in jsoneditor

To help you get started, we’ve selected a few jsoneditor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github leefsmp / Particle-System / Test / src / test-vs / es6-vs-asm.js View on Github external
$(document).ready( ()=> {

  /////////////////////////////////////////////////////////////
  // Sets up config editor
  //
  /////////////////////////////////////////////////////////////
  var editor = new JSONEditor($('.test-config')[ 0 ], {
    search: false
  })

  var defaultTestConfig = {
    dumpParticles: false,
    maxParticles: 1000,
    timeStep: 0.1,
    nbSteps: 5000,
    emitters: [ {
      id: 0,
      position: {
        x: 0,
        y: 0,
        z: 0
      },
      emissionRate: 4000,
github vmware / hillview / web / src / main / webapp / datasetView.ts View on Github external
done.textContent = "Apply";
        done.title = "Upload the new privacy policy and refresh all views.";
        this.privacyEditor.appendChild(done);

        const cancel = document.createElement("button");
        cancel.textContent = "Cancel";
        cancel.title = "Do not update the privacy policy.";
        this.privacyEditor.appendChild(cancel);

        const save = document.createElement("button");
        save.textContent = "Save";
        save.title = "Write the privacy policy to disk, overwriting the existing policy on disk.";
        this.privacyEditor.appendChild(save);

        const editOptions: JSONEditorOptions = { mode: "text", mainMenuBar: false, statusBar: false };
        const editor = new JSONEditor(this.privacyEditor, editOptions, "{}");
        editor.set(this.privacySchema);
        const destroy = () => {
            this.privacyEditor.style.display = "none";
            editor.destroy();
            removeAllChildren(this.privacyEditor);
        };
        done.onclick = () => {
            try {
                const json = editor.getText();  // throws when text is invalid
                this.privacySchema = JSON.parse(json);
                this.uploadPrivacy(json);
                destroy();
            } catch (exception) {
                this.loadMenuPage.reportError(exception.toString());
            }
        };
github josdejong / jsoneditor / examples / react_advanced_demo / src / JSONEditorReact.js View on Github external
componentDidMount () {
    // copy all properties into options for the editor
    // (except the properties for the JSONEditorReact component itself)
    const options = Object.assign({}, this.props);
    delete options.json;
    delete options.text;

    this.jsoneditor = new JSONEditor(this.container, options);

    if ('json' in this.props) {
      this.jsoneditor.set(this.props.json);
    }
    if ('text' in this.props) {
      this.jsoneditor.setText(this.props.text);
    }
    this.schema = cloneDeep(this.props.schema);
    this.schemaRefs = cloneDeep(this.props.schemaRefs);
  }
github asvae / laravel-api-tester / resources / assets / js / components / json-editor / abstract-json-editor.vue View on Github external
initEditor(el, options, json){
                this.$options.editor = new JSONEditor(el, options, json)
            }
        }
github DefinitelyTyped / DefinitelyTyped / types / jsoneditor / jsoneditor-tests.ts View on Github external
name: 'foo',
    schema: {},
    schemaRefs: { "otherSchema": {}},
    search: false,
    indentation: 2,
    theme: 'default'
};
options = {
    onEditable(node: Node) {
        return {field: true, value: false};
    }
};

let jsonEditor: JSONEditor;
jsonEditor = new JSONEditor(document.body);
jsonEditor = new JSONEditor(document.body, {});
jsonEditor = new JSONEditor(document.body, options, {foo: 'bar'});

jsonEditor.collapseAll();
jsonEditor.destroy();
jsonEditor.expandAll();
jsonEditor.focus();
jsonEditor.set({foo: 'bar'});
jsonEditor.setMode('text');
jsonEditor.setName('foo');
jsonEditor.setName();
jsonEditor.setSchema({});
jsonEditor.setText('{foo: 1}');
jsonEditor.format();
jsonEditor.compact();
jsonEditor.repair();
github leefsmp / Particle-System / Test / src / test-vs / babel-vs-traceur.js View on Github external
$(document).ready( ()=> {

  var editor = new JSONEditor($('.test-config')[ 0 ], {
    search: false
  })

  var defaultTestConfig = {
    dumpParticles: false,
    maxParticles: 1000,
    timeStep: 0.1,
    nbSteps: 5000,
    emitters: [ {
      id: 0,
      position: {
        x: 0,
        y: 0,
        z: 0
      },
      emissionRate: 4000,
github NarHakobyan / socket-io-client / src / app / components / jsoneditor / jsoneditor.component.ts View on Github external
private initEditor() {
    this.editor = new JSONEditor(this.rootElement.nativeElement, this.options, this.defaultBody);
    this.subscriptions = this.eventToObservable('change').subscribe(event => {
      const value = this.valid();
      if (value) {
        this.bodyChange.emit(value);
      }
    });
  }
github apache / dubbo-admin / dubbo-admin-ui / src / components / public / JsonEditor.vue View on Github external
const options = {
        name: this.name,
        navigationBar: false,
        search: false,
        mode: this.mode,
        modes: this.modes,
        onEditable: (node) => !this.readonly,
        onChange: () => {
          if (this.$jsoneditor) {
            const json = this.$jsoneditor.get()
            this.$emit('input', json)
          }
        },
        templates: this.templates
      }
      this.$jsoneditor = new JSONEditor(this.$el, options)
      this.$jsoneditor.set(this.value || {})
      this.$jsoneditor.expandAll()
    },
    beforeDestroy () {
github Jaspero / fireshop / client / apps / dashboard / src / app / shared / components / json-editor / json-editor.component.ts View on Github external
ngAfterViewInit() {
    let touched = false;

    this.editor = new JSONEditor(this.editorEl.nativeElement, {
      mode: 'tree',
      modes: ['tree', 'code', 'view', 'text'],
      onChange: () => {
        if (!touched) {
          touched = true;
          this.onTouch();
        }

        let value;

        try {
          value = this.editor.get();
        } catch (e) {}

        if (value) {
          this.onChange(value);
github ArnoSaine / react-pouchdb / todoapp / src / shared / JSONEditorComponent.js View on Github external
useEffect(() => {
    jsoneditor.current = new JSONEditor(container.current, {
      mode,
      onChangeJSON: (...args) => onChangeJSONRef.current(...args),
      history: false
    });
    return () => {
      jsoneditor.current.destroy();
    };
  }, [mode]);
  useEffect(() => {

jsoneditor

A web-based tool to view, edit, format, and validate JSON

Apache-2.0
Latest version published 15 days ago

Package Health Score

88 / 100
Full package analysis

Similar packages