You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fortunately, there is a workaround. We need to define the encoder and decoder directly.
DeriveJsonEncoder doesn’t pick up the implicit Codec, only implicit Encoders.
The
DeriveJsonEncoder
andDeriveJsonDecoder
don't pick up implicit Codec instances so it is not possible to override their behavior.I had my custom implicit JsonCodec[Instant] because I don't want my Instants to be decoded as Strings, but numbers:
unfortunately, even though this implicit is in the scope, the derived JsonCodec ignores it and keeps returning a string
Example: https://scastie.scala-lang.org/V2A1rnwwQAGVtjSILEe71g
Fortunately, there is a workaround. We need to define the encoder and decoder directly.
DeriveJsonEncoder doesn’t pick up the implicit Codec, only implicit Encoders.
Workound: https://scastie.scala-lang.org/V2A1rnwwQAGVtjSILEe71g
The text was updated successfully, but these errors were encountered: