Skip to content

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

reset json on parsing error

AykutSarac6dec07736d17
diff --git a/src/utils/json-editor-parser.js b/src/utils/json-editor-parser.js
index b6b00bdd..1f79a84c 100644
--- a/src/utils/json-editor-parser.js
+++ b/src/utils/json-editor-parser.js
@@ -1,3 +1,5 @@
+import { defaultValue } from "src/pages/editor/JsonEditor";
+
/**
* @param {never[] | Object} input
* @returns {import("react-flow-renderer").FlowElement[]}
@@ -57,6 +59,7 @@ export const parser = (input) => {
return [...flatten(res), ...relationships(res)];
} catch (error) {
console.error("An error occured while parsin JSON data!", error.stack);
+ localStorage.setItem('json', JSON.stringify(defaultValue));
return Array;
}
};