【发布时间】:2013-07-05 21:58:05
【问题描述】:
我正在尝试将一段超级简单的 JSON 读取到 Scala 对象中:
JSON:
{"base": 100, "sale": 75}
斯卡拉:
import play.api.libs.json._
import play.api.libs.functional.syntax._
case class Price(base: Int, sale: Option[Int])
object Price {
implicit val priceReads = (
(__ \ "base").read[Int] ~
(__ \ "sale").readNullable[Int]
)(Price)
}
这给了我来自 Play 的以下错误:
【问题讨论】:
-
你可以试试
(Price.apply _)吗?
标签: json scala playframework-2.1