我对 Scala/Lift 很陌生,遇到了以下问题:
class Tests {
case class JTest(
thisUrl:String,
id:Int,
desc:String,
results:String,
isEnabled:Boolean,
attackerAppliance:String,
victimAppliance:String,
lastModified:String)
def displayTest(in: NodeSeq): NodeSeq = {
implicit val formats = DefaultFormats.withHints(
ShortTypeHints(List(classOf[JTest])))
val content = fromInputStream( url.openStream ).getLines.mkString("\n")
val json = parse(content)
val test = json.extract[JTest]
Helpers.bind("test", in,
AttrBindParam("thisUrl", test.thisUrl, "href"),
"id" -> test.id,
"desc" -> test.desc,
"results" -> test.results,
"isEnabled" -> test.isEnabled,
"attackerAppliance" -> test.attackerAppliance,
"victimAppliance" -> test.victimAppliance,
"lastModified" -> test.lastModified)
}
}
我收到以下错误消息:
Message: net.liftweb.json.MappingException: Do not know how to deserialize 'JTest'
示例 JSON:
{"jsonClass":"JTest","thisUrl":"/api/test/1","id":1,"desc":"Vulnerability in Server Service","results":"/api/test/1/results","isEnabled":true,"attackerAppliance":"/api/appliance/2","victimAppliance":"/api/appliance/6","lastModified":"2012-08-08 11:46:29.004"}
我尝试了几件事,但它接缝我卡在这里。任何人都可以指出我正确的方向吗?顺便提一句。我正在使用 scala 2.7.7!
干杯,恩佐