我想使用Lift-JSON (v2.2)和Play框架将JSON文件解析为Scala case类。我使用的是scala 2.8.1和play 1.1以及scala Plugingv0.8。首先,我从https://github.com/lift/lift/tree/master/framework/lift-base/lift-json/复制了将值提取到类中的代码(Person类,“提取值”一节。当我浏览到localhost查看收到的结果时
play.exceptions.JavaExecutionException: Parsed JSON values do not match with class constructor
args=
arg types=
constructor=public controllers.Person(java.lang.String,controllers.Address,scala.collection.immutable.List)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:285)
at Invocation.HTTP Request(Play!)
Caused by: net.liftweb.json.MappingException: Parsed JSON values do not match with class constructor
args=
arg types=
constructor=public controllers.Person(java.lang.String,controllers.Address,scala.collection.immutable.List)
at net.liftweb.json.Meta$.fail(Meta.scala:128)
...我想Play以某种方式在REPL模式下运行scala命令(这里讨论的问题是:http://caffiendfrog.blogspot.com/2010/11/scala-json-lift-web-trouble-with.html )。我很欣赏您使用play和lift-json解析/提取json对象的经验。
发布于 2011-02-27 11:51:40
我从lift-json切换到https://github.com/codahale/jerkson,问题解决了。
发布于 2011-03-20 17:52:36
你应该看一下another discussion about this problem,看起来是这样解释的:)
https://stackoverflow.com/questions/4758661
复制相似问题