title: Problem deserializing ZonedDateTime string using specified format
body: <p>I have been working a fair bit with the ZonedDateTime object using the Kotlin programming language, but have come to a point that has ultimately stumped me. I am given a string representation of a ZonedDateTime object, which is in this format: (&quot;yyyy-MM-dd HH:mm:ss.SSSX&quot;) via json and need to deserialize that back into the ZonedDateTime object. Ive tried several methods of doing this:</p>
  <p>Kotlinx seralization:</p>
  <pre><code>object ZonedDateTimeSerializer : KSerializer&lt;ZonedDateTime&gt; {
      override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor(&quot;ZonedDateTime&quot;, PrimitiveKind.STRING)
      override fun serialize(encoder: Encoder, value: ZonedDateTime) = encoder.encodeString(value = value.toString())
      override fun deserialize(decoder: Decoder): ZonedDateTime = ZonedDateTime.parse(decoder.decodeString(), DateTimeFormatter.ofPattern(&quot;yyyy-MM-dd HH:mm:ss.SSSX&quot;))
  }
  </code></pre>
  <p>@JsonFormat Annotation on the object property itself:</p>
  <pre><code>@JsonFormat(pattern = &quot;yyyy-MM-dd HH:mm:ss.SSSX&quot;, timezone = &quot;America/Chicago&quot;)
  </code></pre>
  <p>And even a homemade JsonSerializer/JsonDeserializer (and their accompanying annotations on the property itself, buts that's self-explanatory):</p>
  <pre><code>class ZonedDateTimeSerializer : JsonSerializer&lt;ZonedDateTime&gt;() {
      @Throws(IOException::class, JsonProcessingException::class)
      override fun serialize(value: ZonedDateTime?, generator: JsonGenerator?, provider: SerializerProvider?) {
          generator?.let { g -&gt;
              value?.let { v -&gt; g.writeString(value.format(DateTimeFormatter.ofPattern(&quot;yyyy-MM-dd HH:mm:ss.SSSX&quot;))) } ?: g.writeNull()
          }
      }
  }
  
  class ZonedDateTimeDeserializer: JsonDeserializer&lt;ZonedDateTime&gt;() {
      @Throws(IOException::class, JsonProcessingException::class)
      override fun deserialize(parser: JsonParser?, context: DeserializationContext?): ZonedDateTime? {
          parser?.let { p -&gt;
              p.text?.let { s -&gt;
                  return ZonedDateTime.parse(s, DateTimeFormatter.ofPattern(&quot;yyyy-MM-dd HH:mm:ss.SSSX&quot;))
              }
          }
          return null
      }
  }
  </code></pre>
  <p>However, regardless of the method used, I consistently get the same error:</p>
  <pre><code>WARN  o.s.w.s.m.s.DefaultHandlerExceptionResolver - Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize value of type `java.time.ZonedDateTime` from String &quot;2022-03-30 10:32:33.099-05&quot;: Failed to deserialize java.time.ZonedDateTime: (java.time.format.DateTimeParseException) Text '2022-03-30 10:32:33.099-05' could not be parsed at index 10; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.time.ZonedDateTime` from String &quot;2022-03-30 10:32:33.099-05&quot;: Failed to deserialize java.time.ZonedDateTime: (java.time.format.DateTimeParseException) Text '2022-03-30 10:32:33.099-05' could not be parsed at index 10
  
  </code></pre>
  <p>What am I missing in the deserialization of this object?</p>