angularjseditorjsoneditor

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


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


Solution

  •     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.