"""把 AuditResult 序列化为 JSON 字符串。"""

import json
from fastapi_modules.fastapi_leaudit.govdoc_engine.engine.result import AuditResult


def to_json(result: AuditResult, indent: int = 2) -> str:
    return json.dumps(
        result.model_dump(mode="json"),
        ensure_ascii=False,
        indent=indent,
    )
