2
考慮:解碼與成功歷史?
import argonaut._, Argonaut._
case class Person(name: String)
implicit def decode: DecodeJson[Person] =
DecodeJson (c =>
for {
name <- (c --\ "name").as[String]
} yield Person(name)
)
scala> Parse.decode[Person]("""{"name": "Bob", "foo": "dunno"}""")
res5: Either[Either[String,(String, argonaut.CursorHistory)],Person] =
Right(Person(Bob))
我怎樣才能decode
,即JSON => Person
,用光標的歷史?按歷史記錄,我的意思是,我想知道"foo" : "dunno"
未被查看/遍歷。