Skip to content

Serializers API

d3_bridge.data.serializers.serialize_data(data, fields=None, **kw)

Universal serializer — detects data type and serializes accordingly.

Supports: - Django QuerySet → list of dicts - GeoQuerySet → GeoJSON FeatureCollection - list/tuple of dicts → passthrough - dict → wrap in list - pandas DataFrame → list of records (if pandas available)

d3_bridge.data.serializers.serialize_queryset(qs, fields=None)

Serialize a Django QuerySet to a list of dicts.

d3_bridge.data.serializers.serialize_geojson(qs, geometry_field=None, properties=None)

Serialize a GeoQuerySet to a GeoJSON FeatureCollection.