An open API service indexing awesome lists of open source software.

https://github.com/koriit/ktor-time

Data conversions for Java Time types
https://github.com/koriit/ktor-time

data-conversion jsr-310 kotlin ktor ktor-feature ktor-plugin

Last synced: 6 months ago
JSON representation

Data conversions for Java Time types

Awesome Lists containing this project

README

          

= Ktor Time Converters

image:https://github.com/Koriit/ktor-time/actions/workflows/build.yaml/badge.svg[Build, link="https://github.com/Koriit/ktor-time/actions/workflows/build.yaml"]
image:https://www.codefactor.io/repository/github/koriit/ktor-time/badge[CodeFactor,link=https://www.codefactor.io/repository/github/koriit/ktor-time]
image:https://img.shields.io/badge/code%20style-%E2%9D%A4-FF4081.svg[ktlint,link=https://ktlint.github.io/]

image:https://img.shields.io/maven-central/v/com.koriit.kotlin/ktor-time.svg?label=Maven%20Central[Maven Central, link="https://search.maven.org/search?q=g:%22com.koriit.kotlin%22%20AND%20a:%22ktor-time%22"]
image:https://img.shields.io/github/license/koriit/ktor-time[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
[source,kotlin]
----
install(DataConversion) {
convertTime()
}
----

You can also install converters of specific types.
[source,kotlin]
----
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...