title: Spring Data JPA - ZonedDateTime format for json serialization
body: <p>I have a problem with the json serialization of <code>ZonedDateTime</code>. When converted to json it produces an enormous object and I don't want all that data to be transfered every time. So i tried to format it to ISO but it doesn't work. How can i get it to format?</p>
  
  <p>Here is my Entity Class:</p>
  
  <pre><code>@MappedSuperclass
  public abstract class AuditBase {
  
      @Id
      @GeneratedValue
      private Long id;
  
      @CreatedDate
      private ZonedDateTime createdDate;
  
      @LastModifiedDate
      private ZonedDateTime lastModifiedDate;
  
      @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
      public ZonedDateTime getLastModifiedDate() {
          return lastModifiedDate;
      }
  
      public void setLastModifiedDate(ZonedDateTime lastModifiedDate) {
          this.lastModifiedDate = lastModifiedDate;
      }
  
      @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
      public ZonedDateTime getCreatedDate() {
          return createdDate;
      }
  
      public void setCreatedDate(ZonedDateTime createdDate) {
          this.createdDate = createdDate;
      }
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      @PrePersist
      public void prePersist() {
          this.createdDate = ZonedDateTime.now();
          this.lastModifiedDate = ZonedDateTime.now();
      }
  
      @PreUpdate
      public void preUpdate() {
          this.lastModifiedDate = ZonedDateTime.now();
      }
  }
  </code></pre>