Initial upload: git-insights-cli with CI/CD workflow
This commit is contained in:
15
src/formatters/json_formatter.py
Normal file
15
src/formatters/json_formatter.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
from src.formatters.base import BaseFormatter
|
||||
|
||||
|
||||
class JSONFormatter(BaseFormatter):
|
||||
"""JSON output formatter."""
|
||||
|
||||
@staticmethod
|
||||
def format(data: Any) -> str:
|
||||
"""Format data as JSON."""
|
||||
if hasattr(data, "to_dict"):
|
||||
data = data.to_dict()
|
||||
return json.dumps(data, indent=2, default=str)
|
||||
Reference in New Issue
Block a user