斯卡拉代码:
import net.liftweb.json._
case class Province(id: String, name: String, parentName: Option[String], parentId: Option[String])
case class ProvinceJson(provinceData: List[Province])
object Test extends Application {
val json = """ {
| "provinceData":
| [
| {
| "name":"hb",
| "parentName":null,
| "parentId":null,
| "id":"450"
| }
| ]
|}
| """.stripMargin
parse(json).extract[ProvinceJson]
}
当我运行这段代码时,它会报告编译错误:
could not find implicit value for parameter formats: net.liftweb.json.Formats
parse(json).extract[ProvinceJson]
^
not enough arguments for method extract: (implicit formats: net.liftweb.json.Formats, implicit mf: scala.reflect.Manifest[com.thoughtworks.sfexpress.sf_ws.ProvinceJson])com.thoughtworks.sfexpress.sf_ws.ProvinceJson.
Unspecified value parameters formats, mf.
parse(json).extract[ProvinceJson]
^
我想念什么吗?