title: serialization format datetime jackson joda spring mvc
body: <p>Howto serialize POJO. I'm using jackson, spring mvc 4, hibernate 4, joda time I have:</p>
  
  <pre><code>@Entity
  public class MyPojo {
  
    @Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime") 
    private DateTime duedate;
  
  //getters setters..
  }
  
  
  //my config:
      @Bean
      public ObjectMapper objectMapper(){
          ObjectMapper objectMapper = new ObjectMapper();
          objectMapper.registerModule(new JodaModule());
          objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS,false);
          objectMapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, true);
          objectMapper.configure(SerializationFeature.EAGER_SERIALIZER_FETCH, false);
          objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS,false);
          return objectMapper;
      }
  
  
  //my calling for deserialization POJO:
  
  ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
  String jsonDemand=ow.writeValueAsString(demand);
  System.out.println("jsonDemand"+jsonDemand);
  </code></pre>
  
  <p>//from the output I'm always getting I think "deep" serialization like that:</p>
  
  <pre><code> "duedate" : {
      "year" : 2014,
       "dayOfMonth" : 22,
       "dayOfWeek" : 4,
       "era" : 1,
       "dayOfYear" : 142,
       "weekOfWeekyear" : 21,
       "weekyear" : 2014,
       ...
    }
  </code></pre>
  
  <p>but I want simple serialization format like that "yyyy-MM-dd'T'HH:mm". </p>