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.

JSON default serializers for date/datetime differ javadsl to scaladsl

See original GitHub issue

Default JSON serializers for Lagom’s javadsl and scaladsl use different format when serializing java.time.Instant (this potentially impacts other date/datetime related classes).

online-auction-scala serializes bidTime in Bid instances using string/rfc3339 format. online-auction-java serializes bidTime in Bid instances using a float representing seconds since epoch (with at least 2 decimals, maybe more?).

This issue is not to discuss what is the most appropriate format for each class in java.time but to settle and document the behavior of the default json serializers. Since each API uses a different underlying implementation (“jackson with JavaTimeModule” vs play-json) using differnt formats for same types could block interop between LagomJava and LagomScala.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jropercommented, Apr 13, 2017

I think we should change the Jackson configuration to use RFC3339 - Swagger uses this, and I think it tends to be pretty standard across the web to use it. We should of course make it configurable, and not do it until a major release, documenting it in the migration guide.

0reactions
ignasi35commented, Jun 26, 2019

This is fixed in #1955

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jersey + Jackson JSON date format serialization
I am using Jersey + Jackson to provide REST JSON services layer for my application. The problem I have is that the default...
Read more >
How to serialize Date and DateTime to JSON without losing ...
This blog post teaches you that depending on the way you serialize your Date and DateTime values to JSON, you could lose information....
Read more >
DSL-JSON library - Scaladex
Java JSON library designed for performance. Built for invasive software composition with DSL Platform compiler. JVM serializers benchmark results ...
Read more >
Formats, Serializers, and Deserializers
Schema Format Extensibility¶. By default, Schema Registry loads schema plugins for Avro, Protobuf, and JSON Schema. When using the REST API, specify the...
Read more >
Formatting Date For Serialization using Jackson
This serializer formats date properties as timestamp by default: ... Next, we'll see how we can use @JsonFormat to format date fields.
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