How to set code view as deafult instead of tree in jsoneditor

840 views Asked by At

https://github.com/mariohmol/ang-jsoneditor.

I have used the above library for jsoneditor.Here I have tree view as default one.But I want code view .How to set it and where do I change it.I am finidng html elements in inspect but in code i am not finding them.here tree view appears when page loads

1

There are 1 answers

0
Paul von Hoesslin On BEST ANSWER
    const container = document.getElementById("id_editor");
    var options = {
        modes: ['code', 'tree'],
        mode: "code",
    };
    const editor = new JSONEditor(container, options);

Note the mode key (NOT MODES) in the options dictionary.