我正在使用
Zeppelin notebooks
为一个
Spark Streaming
应用它接收小
JSON
通过事件总线的消息,我需要以(最好)分布式方式解析这些消息。我选择了
spray-json
对单个消息进行反序列化,但我似乎无法使其工作。我认为这是因为
齐柏林飞艇笔记本
通过某种REPL接口进行解释。
我直接从
docs
:
case class Color(name: String, red: Int, green: Int, blue: Int)
object Color
object MyJsonProtocol extends DefaultJsonProtocol {
implicit val colorFormat = jsonFormat4(Color.apply)
}
但它给了我以下输出:
defined class Color
defined object Color
warning: previously defined class Color is not a companion to object Color.
Companions must be defined together; you may wish to use :paste mode for this.
<console>:75: error: value apply is not a member of object Color
Note: implicit value colorFormat is not applicable here because it comes after the application point and it lacks an explicit result type
implicit val colorFormat = jsonFormat4(Color.apply)
有没有其他方法可以让我在
Zeppelin notebook
? 我没有义务
喷雾json
,但它看起来确实像一个不错的图书馆。