title: How to provide a custom Deserializer for akka-http query parameters?
body: <p>The <a href="http://doc.akka.io/docs/akka/2.4.7/scala/http/routing-dsl/directives/parameter-directives/parameters.html" rel="nofollow noreferrer">akka-http 2.4.7 reference</a> states that it's possible to do custom <code>Deserializer</code>s to convert query parameters, without storing them in an intermediate variable:</p>
  
  <blockquote>
    <p><code>"amount".as[Int]</code> extract value of parameter "amount" as Int, you need a matching Deserializer in scope for that to work (see also Unmarshalling)</p>
    
    <p><code>"amount".as(deserializer)</code> extract value of parameter "amount" with an explicit Deserializer</p>
  </blockquote>
  
  <p>However, the <a href="http://doc.akka.io/docs/akka/2.4.7/scala/http/routing-dsl/directives/parameter-directives/parameters.html#Deserialized_parameter" rel="nofollow noreferrer">Deserialized parameter</a> sample on that page does not show how custom deserializers are being used.</p>
  
  <p>How do I define one, so that I can say, e.g. <code>.as[MyType]</code>?</p>
  
  <p>I think the documentation is at fault, because I cannot find a <code>Deserializer</code> mentioned anywhere in akka sources: <a href="https://github.com/akka/akka/search?utf8=%E2%9C%93&amp;q=Deserializer" rel="nofollow noreferrer">search</a></p>
  
  <p><a href="https://i.stack.imgur.com/m4Btf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/m4Btf.png" alt="enter image description here"></a></p>
  
  <p><em>Screenshot on how <code>Deserializer</code> is typeset in the Akka docs.</em></p>