blob: c759131f314619141a81d837cfd07b93205fb130 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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)
|