Hi, 

I'm unsure if it's more related to spray json or to how akka unmarshalling 
works (or maybe I don't completely understand how to chain implicits 
properly) but still I would be very grateful for any help. 
Here is a (simplified) code snippet illustrating my problem:

import spray.json.DefaultJsonProtocol
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import akka.http.scaladsl.model.HttpResponse
import akka.http.scaladsl.unmarshalling.Unmarshal
import akka.stream.Materializer

import scala.concurrent.{ExecutionContext, Future}

class Test(implicit ec: ExecutionContext, mat: Materializer) extends 
DefaultJsonProtocol {

  def test(response: HttpResponse): Future[Either[String, Long]] =  {
    Unmarshal(response.entity).to[Either[String, Long]]
  }
}


This doesn't compile with: 
Error:(14, 34) could not find implicit value for parameter um: 
akka.http.scaladsl.unmarshalling.Unmarshaller[akka.http.scaladsl.model.ResponseEntity,Either[String,Long]]
    Unmarshal(response.entity).to[Either[String, Long]]
                                 ^                       ^

Can anybody explain me what's missing? (in my live scenario Left/Right 
types of Either are two different case classes one of which represent an 
error, another one - payload)

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to