Skip to content

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

fix: invalid json error

AykutSaracfe5a4a41ef67
diff --git a/src/lib/utils/json/jsonAdapter.ts b/src/lib/utils/json/jsonAdapter.ts
index 8b84567d..157486f4 100644
--- a/src/lib/utils/json/jsonAdapter.ts
+++ b/src/lib/utils/json/jsonAdapter.ts
@@ -42,6 +42,8 @@ const contentToJson = async (value: string, format = FileFormat.JSON): Promise<o
if (format === FileFormat.CSV) json = await csv2json(value);
if (format === FileFormat.XML && keyExists(json, "parsererror")) throw Error("Unknown error!");
+ if (!json) throw Error("Invalid JSON!");
+
return Promise.resolve(json);
} catch (error: any) {
throw error;