I want to check the json in jsoneditor is valid or not. i am getting errors in console.log if any error
If you try to get the JSON via jsoneditor.get(), and error will be thrown when invalid, and JSON will be returned when valid.
what it will return if error occurred, if no errors all good. but if any error raises i wanted to catch the error . how can i achieve this. help is appriciated. thank you
try {
var json = jsoneditor.get();
console.log('JSON is valid', json);
}
catch (err) {
console.error('JSON is invalid', err);
}
That works for me Thanks a lot
ok
it's great!
Most helpful comment