我在scala中有一个case类,它需要解析一个json对象。但是,json对象可以有两种不同的方式。将它们解析到Scala中的同一个case类中。我试过做这样的事情:
case class Hint(`type`:Option[String] = None,template:Option[String], structure: Option[L
deriveDecoder[HttpHeader]只是得到一个错误的couldnot find Lazy implicit value of type io.circe.generic.decoding.DerivedDecoder[akka.http.scaladsl.model.HttpHeader
我使用密封的特征作为枚举来进行详尽的模式匹配。在我使用case对象而不是case类扩展我的特征的情况下,我希望编码和解码(通过)仅仅是一个普通字符串。例如:case object On extends State
val a: State = State.Offa.asJson.noSpaces // trying