diff options
| author | Павел Жуков <33721692+LeaveMyYard@users.noreply.github.com> | 2023-02-24 14:47:44 +0200 |
|---|---|---|
| committer | Павел Жуков <33721692+LeaveMyYard@users.noreply.github.com> | 2023-02-24 14:47:44 +0200 |
| commit | 26b0cf460167f5c6462b39b551ff4f138f86682c (patch) | |
| tree | 6e197f23ba259e5fa156bf81a8e49f7b86b129af /robusta_krr/formatters/json.py | |
| parent | 6fade1efbc920637b42ff336f576cc7604d90627 (diff) | |
Finish code structure
Diffstat (limited to 'robusta_krr/formatters/json.py')
| -rw-r--r-- | robusta_krr/formatters/json.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/robusta_krr/formatters/json.py b/robusta_krr/formatters/json.py new file mode 100644 index 0000000..c759131 --- /dev/null +++ b/robusta_krr/formatters/json.py @@ -0,0 +1,21 @@ +from __future__ import annotations + +from robusta_krr.core.formatters import BaseFormatter +from robusta_krr.core.result import Result + + +class JSONFormatter(BaseFormatter): + """Formatter for JSON output.""" + + __display_name__ = "json" + + def format(self, result: Result) -> str: + """Format the result as JSON. + + :param result: The results to format. + :type result: :class:`core.result.Result` + :returns: The formatted results. + :rtype: str + """ + + return result.json(indent=2) |
