Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS not respected #21

Closed
JPMoresmau opened this issue Mar 22, 2017 · 1 comment · Fixed by #23
Closed

DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS not respected #21

JPMoresmau opened this issue Mar 22, 2017 · 1 comment · Fixed by #23
Milestone

Comments

@JPMoresmau
Copy link
Contributor

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.

@cowtowncoder
Copy link
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.

@cowtowncoder cowtowncoder changed the title DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS not respected DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS not respected Mar 27, 2017
@cowtowncoder cowtowncoder added this to the 2.9.0.pr3 milestone Mar 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants