title: Jackson json formatting of zoneddatetime
body: <p>I need to define the JsonFormat of a ZonedDateTime in which the time is defined in a xml message.</p>
  
  <p>I added the Jackson jar to format ZonedDateTime (com.fasterxml.jackson.datatype.jsr310.JavaTimeModule)</p>
  
  <p>Added the JavaTimeModule like this:</p>
  
  <pre><code>XmlMapper xmlMapper = new XmlMapper();
  xmlMapper.registerModule(new JavaTimeModule());
  xmlMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
  </code></pre>
  
  <p>The problem is that it cannot format the datetime correctly.
  The error is:</p>
  
  <blockquote>
    <p>com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot
    deserialize value of type <code>java.time.ZonedDateTime</code> from String "2019
    3 4 14 44 20 -5": Text '2019 3 4 14 44 20 -5' could not be parsed at
    index 18</p>
  </blockquote>
  
  <p>This is how I am defining the time pattern:</p>
  
  <pre><code>@JsonFormat(pattern = "yyyy M e k m s X")
  private ZonedDateTime openDtGmt;
  </code></pre>
  
  <p>How can I map the zone pattern when it has a negative in the string?</p>
  
  <p><strong>UPDATE</strong>
  I realize that the date is not consistent with conventions.  But this is coming from a legacy system and cannot be changed.
  We need to identify the date/time pattern to be this:
  4 digit year; all remaining digits do NOT have leading zeros; then a timezone without leading zeros and a sign before the digit.
  Also, the timezone is GMT time.  The format for the timezone is UTC.</p>
  
  <p>We replaced XmlMapper with ObjectMapper.
  That seems to get us past the date/time format error but within the XML there is an empty tag in which it is failing.
  If we can get past the empty tag error, we can parse the date/time with our own method.</p>
  
  <p><strong>UPDATE</strong>
  After more testing, it seems that the error we are getting when using the ObjectMapper has to do with an empty tag. It seems that the xml string is too long. It errors at the 1000 character length.</p>