Hello, I saw a post about lift-json on the scala-user list so I
decided to check it out.  I was particularly interested in the ability
to call something along the lines of json.extract[MyClass].  I set up
a little test case for this though, and apparently having a val of any
sort in my case class causes the below exception.  Any thoughts?

My classes looked like this:
case class MyName(first:String, last:String)
case class MyUser(id:String, name:MyName, url:String) {
  val wtf = "wtf"
}

And the output of my test

[info]   lift-json should
[info]   x do pain-free json conversion on nested objects
net.liftweb.json.MappingException: Expected JField but got JNothing,
json='JField(name,JObject(List(JField(first,JString(Lincoln)), JField
(last,JString(Hochberg)))))', path='wtf'
        at net.liftweb.json.Extraction$.net$liftweb$json$Extraction$
$fail(Extraction.scala:151)
        at net.liftweb.json.Extraction$.fieldValue$1(Extraction.scala:
106)
        at net.liftweb.json.Extraction$.build$1(Extraction.scala:78)
        at net.liftweb.json.Extraction$$anonfun$1.apply
(Extraction.scala:84)
        at net.liftweb.json.Extraction$$anonfun$1.apply
(Extraction.scala:84)
        at scala.List.flatMap(List.scala:1132)
        at net.liftweb.json.Extraction$.build$1(Extraction.scala:84)
        at net.liftweb.json.Extraction$$anonfun$1.apply
(Extraction.scala:84)
        at net.liftweb.json.Extraction$$anonfun$1.apply
(Extraction.scala:84)
        at scala.List.flatMap(List.scala:1132)
        at net.liftweb.json.Extraction$.build$1(Extraction.scala:84)
        at net.liftweb.json.Extraction$.extract0(Extraction.scala:109)
        at net.liftweb.json.Extraction$.extract(Extraction.scala:60)
        at net.liftweb.json.JsonAST$JValue.extract(Json.scala:109)
        at com.hotpotato.core.SerializationSpec$$anonfun$1$$anonfun
$apply$1.apply(SerializationSpec.scala:87)
        at com.hotpotato.core.SerializationSpec$$anonfun$1$$anonfun
$apply$1.apply(SerializationSpec.scala:69)
        at org.specs.specification.ExampleExecution$$anonfun$3$$anonfun
$apply$1.apply(Example.scala:207)
        at org.specs.specification.Example.execute(Example.scala:121)
        at org.specs.specification.ExampleLifeCycle$class.executeTest
(ExampleLifeCycle.scala:20)
        at org.specs.Specification.executeTest(Specification.scala:28)
        at org.specs.specification.Sus.executeTest(Sus.scala:147)
        at org.specs.specification.ExampleExecution$$anonfun$3.apply
(Example.scala:207)
        at org.specs.specification.ExampleExecution$$anonfun$3.apply
(Example.scala:194)
        at org.specs.specification.ExampleExecution$$anonfun$2.apply
(Example.scala:185)
        at org.specs.specification.ExampleExecution.execute
(Example.scala:227)
        at org.specs.specification.Example.execute(Example.scala:117)
        at org.specs.specification.Example.errors(Example.scala:143)
        at org.specs.specification.Sus$$anonfun$successes$1.apply
(Sus.scala:122)
        at org.specs.specification.Sus$$anonfun$successes$1.apply
(Sus.scala:122)
        at scala.List.filter(List.scala:859)
        at org.specs.specification.Sus.successes(Sus.scala:122)
        at org.specs.Specification$$anonfun$successes$1.apply
(Specification.scala:84)
        at org.specs.Specification$$anonfun$successes$1.apply
(Specification.scala:84)
        at scala.List.flatMap(List.scala:1132)
        at org.specs.Specification.successes(Specification.scala:84)
        at sbt.impl.SpecsRunner.sbt$impl$SpecsRunner$
$reportSpecification(TestFrameworkImpl.scala:140)
        at sbt.impl.SpecsRunner.runTest(TestFrameworkImpl.scala:123)
        at sbt.BasicTestRunner.run(TestFramework.scala:38)
        at sbt.TestFramework$$anonfun$7$$anonfun$apply$8.runTest$1
(TestFramework.scala:136)
        at sbt.TestFramework$$anonfun$7$$anonfun$apply$8$$anonfun$apply
$9.apply(TestFramework.scala:147)
        at sbt.TestFramework$$anonfun$7$$anonfun$apply$8$$anonfun$apply
$9.apply(TestFramework.scala:147)
        at sbt.NamedTestTask.run(TestFramework.scala:57)
        at sbt.ScalaProject$$anonfun$sbt$ScalaProject$$toTask$1.apply
(ScalaProject.scala:167)
        at sbt.ScalaProject$$anonfun$sbt$ScalaProject$$toTask$1.apply
(ScalaProject.scala:167)
        at sbt.TaskManager$Task.invoke(TaskManager.scala:62)
        at sbt.impl.RunTask.runTask(RunTask.scala:78)
        at sbt.impl.RunTask.sbt$impl$RunTask$$runIfNotRoot
(RunTask.scala:63)
        at sbt.impl.RunTask$$anonfun$runTasksExceptRoot$3.apply
(RunTask.scala:49)
        at sbt.impl.RunTask$$anonfun$runTasksExceptRoot$3.apply
(RunTask.scala:49)
        at sbt.Distributor$Run$Worker$$anonfun$2.apply
(ParallelRunner.scala:130)
        at sbt.Distributor$Run$Worker$$anonfun$2.apply
(ParallelRunner.scala:130)
        at sbt.Control$.trapUnit(Control.scala:19)
        at sbt.Distributor$Run$Worker.run(ParallelRunner.scala:130)
[error]   net.liftweb.json.MappingException: Expected JField but got
JNothing, json='JField(name,JObject(List(JField(first,JString
(Lincoln)), JField(last,JString(Hochberg)))))', path='wtf'

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to