1
我写了这个代码来读取和使用瑟茜使用瑟茜为普通类(不区分类别)
import io.circe._, io.circe.generic.auto._, io.circe.parser._, io.circe.syntax._
case class Foo(i: Int)
val f = Foo(10)
val json = f.asJson.toString
val t1 = decode[Foo](json)
这个作品非常好写josn解码。但是,如果我创建了一个普通类酒吧
class Bar { var i : Int = 0 }
decode[Bar](json)
现在,我得到错误
could not find implicit value for evidence parameter of type io.circe.Decoder[$sess.cmd25.Bar]
那么,这可能与正常类并使用瑟茜他们JSON解码?
是的,它只是不能自动生成你的解码器,所以你必须自己写。 – puhlen