We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent af6731f commit e3d17e1Copy full SHA for e3d17e1
1 file changed
ai_forensics/reporting/json_reporter.py
@@ -0,0 +1,22 @@
1
+"""
2
+JSON reporting utilities (optional).
3
4
+
5
+from __future__ import annotations
6
7
+import json
8
+from typing import Any, Dict
9
10
+from ..observability import to_dict
11
12
13
+def to_json_dict(report) -> Dict[str, Any]:
14
+ """Convert AnalysisReport to a JSON-serializable dict."""
15
+ return to_dict(report)
16
17
18
+def write_json(report, path: str) -> None:
19
+ """Write report to a file as pretty JSON."""
20
+ with open(path, "w", encoding="utf-8") as f:
21
+ json.dump(to_json_dict(report), f, indent=2)
22
0 commit comments