Hi all, I have a exception from lift-json when I want to deserialize a json string. (using v2M1).
Basically I have the following class:
@BeanInfo
case class Game(val id:Int,
val bad:Map[String,Plan],
val good:Map[String,Plan])
and I am using
net.liftweb.json.Serialization.read[Game](jsonInString)
to deserialize the jsonInString into a Game case class. Unfortunately I am getting the following error:
net.liftweb.json.MappingException: Can't find primary constructor for class interface scala.collection.immutable.Map
at net.liftweb.json.Meta$.fail(Meta.scala:93)
at net.liftweb.json.Meta$Reflection$$anonfun$primaryConstructorOf$1.apply(Meta.scala:129)
at net.liftweb.json.Meta$Reflection$$anonfun$primaryConstructorOf$1.apply(Meta.scala:129)
at scala.Option.getOrElse(Option.scala:61)
at net.liftweb.json.Meta$Reflection$.primaryConstructorOf(Meta.scala:129)
at net.liftweb.json.Extraction$.newInstance$1(Extraction.scala:106)
at net.liftweb.json.Extraction$.build$1(Extraction.scala:119)
at net.liftweb.json.Extraction$$anonfun$2$$anonfun$apply$1.apply(Extraction.scala:119)
at net.liftweb.json.Extraction$$anonfun$2$$anonfun$apply$1.apply(Extraction.scala:119)
at scala.List.flatMap(List.scala:1132)
at net.liftweb.json.Extraction$$anonfun$2.apply(Extraction.scala:119)
at net.liftweb.json.Extraction$$anonfun$2.apply(Extraction.scala:119)
at net.liftweb.json.Extraction$.newInstance$1(Extraction.scala:106)
at net.liftweb.json.Extraction$.build$1(Extraction.scala:119)
at net.liftweb.json.Extraction$.extract0(Extraction.scala:154)
at net.liftweb.json.Extraction$.extract(Extraction.scala:37)
at net.liftweb.json.JsonAST$JValue.extract(JsonAST.scala:247)
at net.liftweb.json.Serialization$.read(Serialization.scala:50)
I appreciate your comments, Thanks, -A
PS - I tried v2M2 (snapshot @ 10 Feb, 2010 from Scala-tools.org), the exception gone but the serialization is not correct ! See the comments below.