Skip to content

DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS not respected  #21

Closed

Description

@JPMoresmau

the following JSON

{"zdt":["2017-03-22T14:50:08.121+01:00"]}

Cannot be deserialized into the following class:

public static class TestJava8TimeBean{
		private ZonedDateTime zdt=ZonedDateTime.now();
		
		public TestJava8TimeBean(){
			
			
		}
		
		public ZonedDateTime getZdt() {
			return zdt;
		}
		
		public void setZdt(ZonedDateTime zdt) {
			this.zdt = zdt;
		}

But the mapper I use defines:

mapper.configure(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS, true);

So using an array with one value should work. It does with strings. Also probably if DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT is enabled, an empty array should result in a null value.

Activity

  1. cowtowncoder commented on Mar 22, 2017

    @cowtowncoder
    Member

    @JPMoresmau There is no general way for jackson-databind to add support (since it does not know what shapes datatype might support), so every deserializer has to support these features. So there are probably plenty of datatypes that have incomplete support for this feature as well as related (empty String / empty Array to null).

    I assume this is with 2.8.7.

  2. changed the title [-]DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS not respected [/-] [+]`DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS` not respected [/+] on Mar 27, 2017
  3. added this to the 2.9.0.pr3 milestone on Mar 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions