【发布时间】:2017-02-17 09:21:49
【问题描述】:
我有一些 JSON 格式的响应数据:
{ "items" :
[
{"commentId" : "28444760","userId" : "142607","userIP" : "","userName" : "Rock'n'Roll ","userAvatar" : "/i/default_userpic.png ","userIsBlock" : false,"userBanDate" : "",
"userCountry" : "http://ikor.ill.in.ua/f/UA.gif","date" : "16.02.2017, 17:07","text" : "txt","rate" : 2,"isLikeExist" : false,"childComments" : []}
]
}
我想将其解析为列表。
例如,要提取commentId,我使用:
val js = parse(json)\\"items"
val commentId:List[String] = js\\"commentId"\ classOf[JString]
我得到带有 id 的列表
当我尝试解析 date 时,我得到了:
List(16.02.2017, 17:24, 16.02.2017, 17:23)
如何以 List("date time") 格式返回日期列表?
【问题讨论】: