[go: up one dir, main page]

Skip to content

Data conversions for Java Time types

License

Notifications You must be signed in to change notification settings

Koriit/ktor-time

Repository files navigation

Ktor Time Converters

Build CodeFactor ktlint

Maven Central GitHub

Warning
From version 0.3.0 all package names have been renamed to match new artifact group id.

Ktor data converters for JSR310 Java Time types.

Installation

install(DataConversion) {
    convertTime()
}

You can also install converters of specific types.

install(DataConversion) {
    convertLocalDate()
    convertLocalDateTime()
    convertOffsetDateTime()
}

Serialization

The actual serialization/deserialization is delegated to some specialized mapper. This library just offers a ktor data conversion wrapper over it.

Jackson

Jackson is used as default serializer. You can also pass your own ObjectMapper instance to all convert* functions.

Warning
Jackson does not support JSR310 Java Time types by default. You need to register JavaTimeModule:
ObjectMapper().registerModule(JavaTimeModule())

GSON

TODO…​