json-editor
json-editor copied to clipboard
editor doesn't have setValue function and on function
var editor = new JSONEditor(document.getElementById(name + 'JsonEditor'), {});
$jsonEditorDiv.data("editor", editor);
$jsonEditorDiv.data("textarea-dom", $(this).find("textarea"));
if (jsonStr != null && jsonStr.length > 0) {
var json = null;
try {
json = JSON.parse(jsonStr);
}
catch (ex) {
console.log(ex.message);
json = null;
}
if (json != null) {
editor.setValue(json);
}
}
var $textarea = $(this).find("textarea");
editor.on("change", function (e) {
});
+1
Using editor.set() and editor.get() solve issue for me