spray / spray-json

A lightweight, clean and simple JSON implementation in Scala
Apache License 2.0
972 stars 190 forks source link

An `Option` of `List` does not work #172

Closed samthebest closed 8 years ago

samthebest commented 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))

samthebest commented 8 years ago

Was using toJson not parseJson