在发现circe并尝试将其实现到我的play应用程序中后,我找到了以下代码……
implicit val TimestampFormat : Encoder[Timestamp] with Decoder[Timestamp] = new Encoder[Timestamp] with Decoder[Timestamp] {
override def apply(a: Timestamp): Json = Encoder.encodeLong.apply(a.getTime)
override def apply(c: HCursor): Result[Timestamp] = Decoder.decodeLong.map(s => new Timestamp(s)).apply(c)
}问题是apply方法返回Json,似乎没有办法将Circe JSON转换为Plays……
如何使用circe返回JsValues或使用play将circe Json转换为play JsValue?
https://stackoverflow.com/questions/47468720
复制相似问题