func saveVisualizationsToFile()

in index.go [444:471]


func saveVisualizationsToFile(visualizations []Visualization) {
	// Marshal the data into a JSON string
	jsonData, err := json.Marshal(visualizations)
	if err != nil {
		fmt.Println("Error marshaling JSON:", err)
		return
	}

	// Define the file path
	filePath := "result.json"

	// Create or open the file for writing
	file, err := os.Create(filePath)
	if err != nil {
		fmt.Println("Error creating file:", err)
		return
	}
	defer file.Close()

	// Write the JSON data to the file
	_, err = file.Write(jsonData)
	if err != nil {
		fmt.Println("Error writing JSON to file:", err)
		return
	}

	fmt.Printf("JSON data saved to %s\n", filePath)
}