yansenlei/VJsoneditor

Check if json is valid

Opened this issue · 1 comments

Hi,
How could I check for errors before submit the edited json?
Psedo-code:
if (json is valid){
submit form with json
}

You can use $refs get data and check for errors.

<v-jsoneditor ref="editor" v-model="data" :options="options"></v-jsoneditor>
try {
  let data = this.$refs.editor.editor.get();
  console.log(data);
} catch (error) {
  console.log("get error:", error);
}