Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(SyntaxError): Unexpected non-whitespace character after JSON at position 8 (line 1 column 9)

Ramesh Mane4d1636573510
diff --git a/packages/nc-gui/components/monaco/Editor.vue b/packages/nc-gui/components/monaco/Editor.vue
index 2ee7ff1813..100faf5126 100644
--- a/packages/nc-gui/components/monaco/Editor.vue
+++ b/packages/nc-gui/components/monaco/Editor.vue
@@ -257,8 +257,12 @@ watch(vModel, (v) => {
const editorValue = editor?.getValue()
if (!disableDeepCompare && lang === 'json') {
- if (!editorValue || !deepCompare(JSON.parse(v), JSON.parse(editorValue))) {
- editor.setValue(v)
+ try {
+ if (!editorValue || !deepCompare(JSON.parse(v), JSON.parse(editorValue))) {
+ editor.setValue(v)
+ }
+ } catch (e) {
+ console.error('Failed to parse JSON:', e)
}
} else {
if (editorValue !== v) editor.setValue(v)