spray-json nie może prowadzić mapy [String, String]
Mam następujące ustawienia trasy, ale gdy moja mapa zostanie zwrócona w pierwszym pełnym bloku, pojawia się błąd:
could not find implicit value for evidence parameter of type spray.httpx.marshalling.Marshaller[scala.collection.immutable.Map[String,String]]
import spray.routing.HttpService
import akka.actor.Actor
import spray.http.HttpRequest
import spray.routing.RequestContext
import spray.json.DefaultJsonProtocol._
class UserServiceActor extends Actor with RestUserService {
def actorRefFactory = context
def receive = runRoute(linkRoute)
}
trait RestUserService extends HttpService {
val userService = new LinkUserService
def linkRoute =
pathPrefix("user" / Segment) {
userId =>
path("link") {
parameters('service ! "YT") {
complete {
Map("status"-> "OK", "auth_url" -> "http://mydomain.com/auth")
}
}
}
}
}
Wedługten test Powinienem być w stanie przekonwertować mapę na json, gdy importowany jest plik DefaultJsonProtocol._, ale nawet to się nie powiedzie:
val map:Map[String, String] = Map("hi"->"bye")
map.toJson
Cannot find JsonWriter or JsonFormat type class for scala.collection.mutable.Map[String,String]
Nie jestem pewien, co jest nie tak :(