question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

write java.time.localDate

See original GitHub issue

Hello,

java.time.* types seems to be supported so i have a case class like this for testing:

case class Created(
  localDate:LocalDate=LocalDate.now,
  localDateTime: LocalDateTime=LocalDateTime.now,
  time:LocalTime=LocalTime.now
)
object Created {
  implicit val codec: JsonValueCodec[Created] = JsonCodecMaker.make[Created](CodecMakerConfig(skipUnexpectedFields = false))
}

Here is the result of writeToArray :

{"localDateTime":"2018-10-04T11:42:16.849","time":"11:42:16.849"}

I don’t understand why localDate field is skipped even with skipUnexpectedFields = false.

I have another question about date pattern.

Can we custom the output pattern of localDate & localDateTime ?

Thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
plokhotnyukcommented, Oct 4, 2018

I have added the transientDefault flag for the CodecMakerConfig to allow turning off skipping of serialization of field values which matched with defaults: https://github.com/plokhotnyuk/jsoniter-scala/commit/f38e48b102f74330bb2b3ae736d546734e34be23

0reactions
benoit-ponserocommented, Oct 5, 2018

Thanks a lot !

Read more comments on GitHub >

github_iconTop Results From Across the Web

LocalDate (Java Platform SE 8 ) - Oracle Help Center
LocalDate is an immutable date-time object that represents a date, often viewed as year-month-day. Other date fields, such as day-of-year, day-of-week and week- ......
Read more >
java.time.LocalDate Class in Java - GeeksforGeeks
LocalDate, It is a class that represents a date. ; DateTimeFormatter, It is a class used to format and parse date and time....
Read more >
Java 8 Date - LocalDate, LocalDateTime, Instant - DigitalOcean
LocalDate is an immutable class that represents Date with default format of yyyy-MM-dd. We can use now() method to get the current date....
Read more >
Creating a LocalDate with Values in Java | Baeldung
In this tutorial, we'll see how it makes a huge difference. The LocalDate class from the java. time package helps us achieve this....
Read more >
Guide to Java LocalDate - HowToDoInJava
The java.time.LocalDate class, introduced in Java 8, represents a local date without time and zone information e.g. ' 2019-03-27 ' ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found