【发布时间】:2016-02-25 13:21:18
【问题描述】:
使用 org.json4s,我正在尝试编译这段代码:
implicit val formats = org.json4s.DefaultJsonFormats
for {
parsed <- Try(parse(message)).toOption
purchase <- parsed.extractOpt[Item]
} yield {
val datetime = new DateTime(purchase.time)
val roundedTime = datetime.withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0)
Key(purchase.item_id, roundedTime) -> purchase.amount
}
我收到以下错误:
“没有找到org.json4s.Formats。尝试带一个实例 org.json4s.Formats 范围内或使用 org.json4s.DefaultFormats。"
【问题讨论】: