On Wed, Jan 10, 2018 at 3:03 PM, Birajendu Sahu <
bira...@gmail.com> wrote:
> I am using com.fasterxml.jackson.core:jackson-databind gradle plugin in my
> Kotlin application to serialise my data classes in to json objects.
>
> My class looks like this:
>
> data class MyEntityClass(
> var id: Long,
> var name: String,
> var description: String? = null,
> var updatedAt: LocalDateTime,
> var createdAt: LocalDateTime
>
> )
>
> When I serialise this class using jackson object mapper I am getting a json
> in below format
Since `LocalDateTime` is Java 8 date/time type, and since Jackson 2.x
does not require Java 8 (runs on Java 6, compiles on Java 7),
it does not provide support directly. You need to use Java 8 date/time
module from:
https://github.com/FasterXML/jackson-modules-java8/
and artifact name is `jackson-datatype-jsr310` (for Maven dependency
or to get jar).
Module is registered with
ObjectMapper mapper = ...;
mapper.registerModule(new JavaTimeModule());
Without adding this module databind just sees a weird POJO (with
getters) and serializes it that way.
-+ Tatu +-
>
> {
> --
> You received this message because you are subscribed to the Google Groups
> "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
jackson-user...@googlegroups.com.
> To post to this group, send email to
jackso...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.