DEV Community

Cover image for Keep Unix Timestamps at the API Boundary
YeLinAung for dust

Posted on Originally published at dust-codegen.pages.dev

Keep Unix Timestamps at the API Boundary

Complete Dust custom codec model and JSON round-trip example

When an API sends integer milliseconds, one SerDeCodec<DateTime, int> keeps the JSON unchanged while the model works with DateTime. Apply it to required or nullable fields; Dust handles null outside the codec.

Read the Dust custom codec guide.

Dust #Serde #SerDeCodec #CodeGeneration

Top comments (0)