arcade-mcp/toolserve/toolserve/common/serializers.py
2024-04-22 14:13:09 -07:00

15 lines
369 B
Python

from decimal import Decimal
from typing import Any, Sequence, TypeVar
import msgspec
from starlette.responses import JSONResponse
class MsgSpecJSONResponse(JSONResponse):
"""
JSON response using the high-performance msgspec library to serialize data to JSON.
"""
def render(self, content: Any) -> bytes:
return msgspec.json.encode(content)