Export data to a JSON file. :param data: List of dictionaries containing the data to export :param filename: Name of the file to save the JSON data
(data: List[Dict[str, Any]], filename: str)
| 14 | |
| 15 | |
| 16 | def export_to_json(data: List[Dict[str, Any]], filename: str) -> None: |
| 17 | """ |
| 18 | Export data to a JSON file. |
| 19 | |
| 20 | :param data: List of dictionaries containing the data to export |
| 21 | :param filename: Name of the file to save the JSON data |
| 22 | """ |
| 23 | with open(filename, "w", encoding="utf-8") as f: |
| 24 | json.dump(data, f, ensure_ascii=False, indent=4) |
| 25 | logger.info("Data exported to %s", filename) |
| 26 | |
| 27 | |
| 28 | def export_to_csv(data: List[Dict[str, Any]], filename: str) -> None: |