Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
459 views
in Technique[技术] by (71.8m points)

android - Jackson databind InvalidFormatException:无法反序列化org.threeten.bp.ZonedDateTime(Jackson databind InvalidFormatException : Failed to deserialize org.threeten.bp.ZonedDateTime)

How to fixe the InvalidFormatException for 2019-12-01T06:16:50.289+0000

(如何2019-12-01T06:16:50.289+0000 InvalidFormatException2019-12-01T06:16:50.289+0000)

Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of
type `org.threeten.bp.ZonedDateTime` from String "2019-12-01T06:16:50.289+0000": Failed to deserialize 
org.threeten.bp.ZonedDateTime: (org.threeten.bp.format.DateTimeParseException) 
Text '2019-12-01T06:16:50.289+0000'

Object mapper configurations

(对象映射器配置)

  objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true)
  objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
  objectMapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
  objectMapper.configure(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, false)
  objectMapper.configure(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE, false)
  objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS,false)

  objectMapper.registerModule(ThreeTenModule())

Added below dependancies

(添加以下依赖性)

implementation 'com.tinder.scarlet:message-adapter-jackson:0.1.8'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.10.0'
implementation 'com.fasterxml.jackson.core:jackson-core:2.10.0'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.10.0'
implementation 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.9.9'
implementation 'com.github.joschi.jackson:jackson-datatype-threetenbp:2.10.0'

implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.4'
implementation 'javax.xml.bind:jaxb-api:2.3.0'
  ask by Chathura Wijesinghe translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...