---
url: "https://vueda.dev/v3/reference/api/py/vueda.core.renderers.md"
title: "core.renderers"
---

# core.renderers

## Overview

JSON rendering for VUEDA responses.

DRF's own encoder renders a ``timedelta`` as ``str(obj.total_seconds())`` -- a JSON string, not a
JSON number. That is a reasonable default for a serializer field, whose declared type is a string
either way, but it is wrong for a value that never passes through a serializer field at all. A
``Sum`` over a ``DurationField`` is exactly that: ``get_column_info`` puts the aggregate straight
into the response, so a duration total would reach a client as ``"3600.0"`` where every other total
is a number, and where the paginated response schema promises a number.

So the encoder below renders durations as seconds, and the two renderers exist only to use it. DRF
reads the encoder off the renderer class rather than from a setting, so a project cannot swap it in
through ``REST_FRAMEWORK`` alone.

## Classes

- [VuedaJSONEncoder](/v3/reference/api/py/vueda.core.renderers/VuedaJSONEncoder.md)
- [VuedaJSONOpenAPIRenderer](/v3/reference/api/py/vueda.core.renderers/VuedaJSONOpenAPIRenderer.md)
- [VuedaJSONRenderer](/v3/reference/api/py/vueda.core.renderers/VuedaJSONRenderer.md)

## Source

`server/vueda/core/renderers.py`
