我正在尝试使用rapture.io
Scala JSON 解析器来解析rows
如下所示的 JSON 值 ():
{
rows:
[
[
null,
"2016-11-16T15:43:18.000Z",
{
"p": 1,
"q": 2
},
null,
"Game highlights"
],
[
null,
"2007-10-09T01:52:29.000Z",
{
"p": 21,
"q": 99
},
"blaah",
"Game reviews"
]
}
我的代码如下所示:
import rapture.io._
import rapture.codec._
import rapture.json._
import rapture.data._
import rapture.uri._
import rapture.net._
import encodings.system
import jsonBackends.jawn._
class NotesDownloader () {
def download(): Unit = {
val src = uri"https://some_url".slurp[Char]
val jsonResponse = Json.parse(src)
val rows = jsonResponse.data.rows
val rowsBean = rows(0).as[Array[Member]]
println(jsonResponse)
}
case class Member(array: Array[Some[String]])
}
当我尝试将完整数据提取到Member
中时,出现以下异常:
Error:(40, 30) not enough arguments for method as: (implicit ext: rapture.data.Extractor[Array[NotesDownloader.this.Member],rapture.json.Json], implicit mode:
rapture.core.Mode[rapture.data.ExtractionMethods])mode.Wrap[Array[NotesDownloader.this.Member],rapture.data.DataGetException].
Unspecified value parameters ext, mode. val rowsBean = value.as[Array[Member]]
我错过了什么?