Note that there are some explanatory texts on larger screens.

plurals
  1. POserializing and deserializing a json object through Lift-JSON
    text
    copied!<p>I have a exception from lift-json when I want to deserialize a json string. (using v2M1).</p> <p>Basically I have the following class:</p> <pre><code>@BeanInfo case class Game(val id:Int, val bad:Map[String,Plan], val good:Map[String,Plan]) </code></pre> <p>and I am using </p> <pre><code>net.liftweb.json.Serialization.read[Game](jsonInString) </code></pre> <p>to deserialize the jsonInString into a Game case class. Unfortunately I am getting the following error:</p> <pre><code>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) </code></pre> <p>I appreciate your comments, Thanks, -A</p> <p>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.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload