I'm trying to "unpickle" JSON structures like the following with Scala-pickling :
{"id":1,"aList":[{"x":1}, {"x":2}]}
Sadly when unpickling with the following code:
import scala.pickling._, scala.pickling.Defaults._, json._
val jsonString="""{"id":1,"aList":[{"x":1}, {"x":2}]}"""
case class X(id:Int,aList:List[Y])
case class Y(x:Int)
jsonString.unpickle[X]
I get the following exception:
scala.MatchError: [{"x" : 1.0}, {"x" : 2.0}] (of class scala.util.parsing.json.JSONArray)
at scala.pickling.json.JSONPickleReader$$anonfun$beginEntry$2.apply(JSONPickleFormat.scala:212)
at scala.pickling.json.JSONPickleReader$$anonfun$beginEntry$2.apply(JSONPickleFormat.scala:203)
at scala.pickling.PickleTools$class.withHints(Tools.scala:521)
at scala.pickling.json.JSONPickleReader.withHints(JSONPickleFormat.scala:170)
at scala.pickling.json.JSONPickleReader.beginEntry(JSONPickleFormat.scala:203)
Is it possible to use Scala-pickling with lists/sets?