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
- Host: GitHub
- URL: https://github.com/koriit/ktor-time
- Owner: Koriit
- License: mit
- Created: 2019-12-03T08:29:38.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-01-30T16:41:01.000Z (about 4 years ago)
- Last Synced: 2023-07-28T09:17:06.583Z (over 2 years ago)
- Topics: data-conversion, jsr-310, kotlin, ktor, ktor-feature, ktor-plugin
- Language: Kotlin
- Homepage:
- Size: 96.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
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...