Skip to content

DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT not respected? #1571

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

Closed
JPMoresmau opened this issue Mar 22, 2017 · 4 comments
Closed

Comments

@JPMoresmau
Copy link

On 2.8.7, I turn on DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS and DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT. The JSON:

{"id":[]}

Cannot deserialize to an instance of the class:

	public static class TestArrayBean{
		private String id;
		
		public String getId() {
			return id;
		}
		
		public void setId(String id) {
			this.id = id;
		}
}

(Can not deserialize instance of java.lang.String out of END_ARRAY token).
It works if there is a value.
I was hoping to get a non null bean with a null id member.

@JPMoresmau JPMoresmau changed the title DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT not respected? Mar 22, 2017
@JPMoresmau
Copy link
Author

JPMoresmau commented Mar 22, 2017

Duplicate of #994 I think? Any hope of it being addressed, or should I look into providing a patch?

@cowtowncoder
Copy link
Member

@JPMoresmau Yes may well be the same. You may want to close this one, unless you think they differ.

I would hope to address it, but looking at everything I've tagged with 2.9, a PR would certainly improve chances of this getting fixed for 2.9.0 (and if simple enough, backported in 2.8 too).

@JPMoresmau
Copy link
Author

Closed as duplicate of #994

@cowtowncoder
Copy link
Member

FWIW, worked on #994, with (what I hope is) full fix for 2.9.0, partial for 2.8(.8).

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

No branches or pull requests

2 participants