Closed samthebest closed 8 years ago
case class Fred(a: Option[List[Int]] = None) object FredProtocol extends DefaultJsonProtocol { implicit val f = jsonFormat1(Fred.apply) } import spray.json._ import FredProtocol._ "{\"a\":[]}".toJson.convertTo[Fred]
causes
DeserializationException: : Object expected in field 'a' (package.scala:23)
But should return Fred(Some(Nil))
Fred(Some(Nil))
Was using toJson not parseJson
toJson
parseJson
causes
But should return
Fred(Some(Nil))