Following the tutorial from http://www.smartjava.org/content/first-steps-rest-spray-and-scala, there are some unexpected error messages. What is going on? Have I defined implicit JsonWriter by the implicit val personFormat = jsonFormat3(Person)
call?
scala> import spray.json.DefaultJsonProtocol
import spray.json.DefaultJsonProtocol
scala> object MyJsonProtocol extends DefaultJsonProtocol {
implicit val personFormat = jsonFormat3(Person)
}
| | defined object MyJsonProtocol
scala> case class Person(name: String, fistName: String, age: Long)
defined class Person
scala> import spray.json._
import spray.json._
scala> import MyJsonProtocol._
import MyJsonProtocol._
scala> Person(name="a", fistName="b", age = 10).toJson
<console>:45: error: Cannot find JsonWriter or JsonFormat type class for Person
Person(name="a", fistName="b", age = 10).toJson
^