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

{
  "id" : 10,
  "name" : "name10",
  "description" : "description10",
  "updatedAt" : {
    "nano" : 148000000,
    "year" : 2018,
    "month" : "JANUARY",
    "dayOfMonth" : 10,
    "dayOfWeek" : "WEDNESDAY",
    "dayOfYear" : 10,
    "hour" : 22,
    "minute" : 26,
    "second" : 54,
    "monthValue" : 1,
    "chronology" : {
      "id" : "ISO",
      "calendarType" : "iso8601"
    }
  },
  "createdAt" : {
    "nano" : 148000000,
    "year" : 2018,
    "month" : "JANUARY",
    "dayOfMonth" : 10,
    "dayOfWeek" : "WEDNESDAY",
    "dayOfYear" : 10,
    "hour" : 22,
    "minute" : 26,
    "second" : 54,
    "monthValue" : 1,
    "chronology" : {
      "id" : "ISO",
      "calendarType" : "iso8601"
    }
  }
}

How do I make updatedAt and createdAt as single string entry in resulting 
json.

-- 
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 [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to