title: Jersey parsing Java 8 date time
body: <p>This is my user class, and I to save ISO compliant date time in my database.</p>
  
  <pre><code>public class User  {
  
      @Id
      private String id;
  
      private String email;
  
      @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
      private LocalDateTime loginDate;
  
   }
  </code></pre>
  
  <p>Here is my Jersey controller:</p>
  
  <pre><code>@POST
  @Consumes("application/json")
  @Produces("application/json")
  
  public Response create(  User user) {
  
      Map&lt;Object, Object&gt; apiResponse = new HashMap&lt;Object, Object&gt;();
      Map&lt;Object, Object&gt; response  = new HashMap&lt;Object, Object&gt;();
  
  
      user = (User) userService.create(user);
  
  }
  </code></pre>
  
  <p>How can can I consume a datetime format like this one in jersey? Is it possible to send a datatime <code>String</code> and create Java 8 date time object automatically?</p>
  
  <pre><code>{        
      "email" : "imz.mrz@gmail.com"
      "loginDate" : "2015-04-17T06:06:51.465Z"
  } 
  </code></pre>
  
  #
  
  <p>Update:  </p>
  
  <p>I was using Spring boot jersey, and had other jsr packages </p>
  
  <pre><code>  &lt;dependency&gt;
       &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
       &lt;artifactId&gt;spring-boot-starter-jersey&lt;/artifactId&gt;
   &lt;/dependency&gt;
  </code></pre>
  
  <p>So I removed all the packages except from spring-boot-jersey package. 
  use this annotation for LocalDateTime </p>
  
  <pre><code>  @JsonDeserialize(using =  LocalDateTimeDeserializer.class)
  </code></pre>
  
  <p>This way I can consume ISODate and save ISODate() to mongodb and produce full formated mongodb LocalDateTime to frontend. </p>
  
  <p>Problem solved.</p>