title: Jackson date format with @JsonFormat?
body: <p>I want to serialize certain Calendar fields of a POJO with a specific format.</p>
  
  <p>with no annotations, fields like this:</p>
  
  <pre><code>private Calendar timestamp1;
  private Calendar timestamp2;
  </code></pre>
  
  <p>produce JSON like this:</p>
  
  <pre><code>{ ..., timestamp1: 1402402106000, timestamp2: 1402488595000, ... }
  </code></pre>
  
  <p>I would to add a field formatted as a string as it actually represents a Day as a 24-hour unit, not a specific instant of time.  But when I add a new field with an annotation:</p>
  
  <pre><code>@JsonFormat(pattern = "yyyy-MM-dd")
  private Calendar oneDay;
  </code></pre>
  
  <p>I was hoping to get JSON like this:</p>
  
  <pre><code>{ ..., timestamp1: 1402402106000, timestamp2: 1402488595000, oneDay: "2014-06-12", ... }
  </code></pre>
  
  <p>Instead, I got a the following exception:</p>
  
  <pre><code>com.fasterxml.jackson.databind.JsonMappingException: 
      Cannot format given Object as a Date 
      (through reference chain: java.util.HashMap["data"]-&gt;java.util.ArrayList[0]-myPojo["oneDay"])
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>I'm using Jackson 2.2.0</p>