title: unmarshall nested json in spray-json
body: <p>Using spray-json (as I'm using spray-client) in order to get a latitude,longitude object from the google maps API I need to have the whole response structure set up:</p>
  
  <pre><code>case class AddrComponent(long_name: String, short_name: String, types: List[String])
  case class Location(lat: Double, lng: Double)
  case class ViewPort(northeast: Location, southwest: Location)
  case class Geometry(location: Location, location_type: String, viewport: ViewPort)
  case class EachResult(address_components: List[AddrComponent],
                        formatted_address: String,
                        geometry: Geometry,
                        types: List[String])
  case class GoogleApiResult[T](status: String, results: List[T])
  
  object AddressProtocol extends DefaultJsonProtocol {
      implicit val addrFormat = jsonFormat3(AddrComponent)
      implicit val locFormat = jsonFormat2(Location)
      implicit val viewPortFormat = jsonFormat2(ViewPort)
      implicit val geomFormat = jsonFormat3(Geometry)
      implicit val eachResFormat = jsonFormat4(EachResult)
      implicit def GoogleApiFormat[T: JsonFormat] = jsonFormat2(GoogleApiResult.apply[T])
  }
  import AddressProtocol._
  </code></pre>
  
  <p>Is there any way I can just get <code>Location</code> from the json in the response and avoid all this gumph?</p>
  
  <p>The spray-client code:</p>
  
  <pre><code>implicit val system = ActorSystem("test-system")
  import system.dispatcher
  
  private val pipeline = sendReceive ~&gt; unmarshal[GoogleApiResult[EachResult]]
  
  def getPostcode(postcode: String): Point = {
      val url = s"http://maps.googleapis.com/maps/api/geocode/json?address=$postcode,+UK&amp;sensor=true"
      val future = pipeline(Get(url))
      val result = Await.result(future, 10 seconds)
      result.results.size match {
          case 0 =&gt; throw new PostcodeNotFoundException(postcode)
          case x if x &gt; 1 =&gt; throw new MultipleResultsException(postcode)
          case _ =&gt; {
              val location = result.results(0).geometry.location
              new Point(location.lng, location.lat)
          }
      }
  }
  </code></pre>
  
  <p>Or alternatively how can I use jackson with spray-client?</p>