Skip to content

Python scraper based on AI

refactor of conbert to json function

VinciGit0074d7ef614adb
diff --git a/scrapegraphai/utils/convert_to_json.py b/scrapegraphai/utils/convert_to_json.py
index 8ac282cd..c349ad1d 100644
--- a/scrapegraphai/utils/convert_to_json.py
+++ b/scrapegraphai/utils/convert_to_json.py
@@ -22,7 +22,7 @@ def convert_to_json(data: dict, filename: str, position: str = None):
PermissionError: If the program does not have permission to write to the directory.
"""
if ".json" in filename:
- raise ValueError("The filename should not contain '.json'")
+ filename = filename.replace(".json", "") # Remove .csv extension
# Get the directory of the caller script
if position is None: