【发布时间】:2014-10-31 22:13:00
【问题描述】:
我在 Play 2.3 中有以下 JSON 阅读器:
import play.api.libs.json._
import play.api.libs.json.Reads._
val airportSearchReads: Reads[String] = (JsPath \ "search").read[String](minLength(3))
编译器给了我错误
diverging implicit expansion for type play.api.libs.json.Reads[M]
starting with method ArrayReads in trait DefaultReads
如果我使用 implicit val 我会得到
ambiguous implicit values:
both value uuidReads in trait DefaultReads of type => play.api.libs.json.Reads[java.util.UUID]
and value airportSearchReads in object AirportSearch of type => play.api.libs.json.Reads[String]
match expected type play.api.libs.json.Reads[M]
如何让它工作?
【问题讨论】:
标签: json scala playframework playframework-2.0 playframework-json