I may be wrong, but I think kotlin.time.Instant and kotlinx.datetime.Instant serialize differently. My API sends a kotlinx.datetime.Instant and it appears in Json as "2025-09-06T103224.608Z" . I think. Maybe. Can anyone confirm if the two Instant classes serialize differently?
h
hfhbd
09/14/2025, 4:28 PM
Both use ISO8601 by default. The kotlin.time.Instant implementation was just copy pasted into stdlib.
v
v79
09/14/2025, 4:33 PM
Hmm. I wonder why I'm getting an error about there being no serializer for kotlin.time.Instant then? I am on kotlin 2.2.20.
h
hfhbd
09/14/2025, 4:34 PM
You also need kotlinx-serialization runtime 1.9.0
v
v79
09/14/2025, 4:38 PM
I think I had an older version being pulled in by ktor-serialization; I'm on an older version of Ktor client for now.
v79
09/14/2025, 4:49 PM
Serves me right for letting AI do the coding... :)