✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.
fix json validator
AykutSarac67b5d6a1f856
diff --git a/src/components/MonacoEditor/index.tsx b/src/components/MonacoEditor/index.tsxindex fa0a8d74..a65db0e8 100644--- a/src/components/MonacoEditor/index.tsx+++ b/src/components/MonacoEditor/index.tsx@@ -58,18 +58,17 @@ export const MonacoEditor = ({React.useEffect(() => {const formatTimer = setTimeout(() => {- try {- if (!value) {- setHasError(false);- return setJson("{}");- }-- const parsedJSON = JSON.stringify(parse(value), null, 2);- setJson(parsedJSON);+ if (!value) {setHasError(false);- } catch (jsonError: any) {- setHasError(true);+ return setJson("{}");}++ const errors = [];+ const parsedJSON = JSON.stringify(parse(value, errors), null, 2);+ if (errors.length) return setHasError(true);++ setJson(parsedJSON);+ setHasError(false);}, 1200);return () => clearTimeout(formatTimer);