title: How to represent optional fields in spray-json?
body: <p>I have an optional field on my requests:</p>
  
  <pre><code>case class SearchRequest(url: String, nextAt: Option[Date])
  </code></pre>
  
  <p>My protocol is:</p>
  
  <pre><code>object SearchRequestJsonProtocol extends DefaultJsonProtocol {
      implicit val searchRequestFormat = jsonFormat(SearchRequest, "url", "nextAt")
  }
  </code></pre>
  
  <p>How do I mark the nextAt field optional, such that the following JSON objects will be correctly read and accepted:</p>
  
  <pre><code>{"url":"..."}
  {"url":"...", "nextAt":null}
  {"url":"...", "nextAt":"2012-05-30T15:23Z"}
  </code></pre>
  
  <p>I actually don't really care about the null case, but if you have details, it would be nice. I'm using spray-json, and was under the impression that using an Option would skip the field if it was absent on the original JSON object.</p>