Skip to content

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

convert save json to download

AykutSarac4d50410e3211
diff --git a/src/components/Sidebar/index.tsx b/src/components/Sidebar/index.tsx
index 14fb36aa..3be72612 100644
--- a/src/components/Sidebar/index.tsx
+++ b/src/components/Sidebar/index.tsx
@@ -140,8 +140,12 @@ export const Sidebar: React.FC = () => {
const [clearVisible, setClearVisible] = React.useState(false);
const handleSave = () => {
- localStorage.setItem("json", json);
- toast.success("Saved JSON successfully!");
+ const a = document.createElement("a");
+ const file = new Blob([json], { type: "text/plain" });
+
+ a.href = window.URL.createObjectURL(file);
+ a.download = "jsonvisio.json";
+ a.click();
};
const toggleExpandCollapse = () => {