-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Change default for SerializationFeature.FAIL_ON_EMPTY_BEANS
to false
#3070
Comments
Default settings changes are possible for the major version upgrade, although we'd need to figure out some way to gauge how popular change proposals are. |
FAIL_ON_EMPTY_BEANS
from true to false
Presupposing the intention of this feature is to warn the user about potential mistakes in serialization configuration, I'd assert some arguments against a survey/proposal precluding this change:
|
FAIL_ON_EMPTY_BEANS
from true to falseDeserializationFeature.FAIL_ON_EMPTY_BEANS
to false
DeserializationFeature.FAIL_ON_EMPTY_BEANS
to false
SerializationFeature.FAIL_ON_EMPTY_BEANS
to false
I will proceed with this change, so default will change for Jackson 3. |
Changed for 3.0.0-SNAPSHOT (master branch). |
I would expect an empty Object without any field to be rendered as
{}
When I drove a Spring Boot Rest API with an Acceptance Test step by step, I tried to respond with an empty Object at one point, expecting an empty Json Object as a response.
However, Spring noticed that Jackson would not serialize this Object, and instead jumped to the next Converter which caused unrelated Issues. It took me about 1 hour of analyzing at the wrong end, to figure out the real cause.
I think it would be beneficial for developers, if the default of
FAIL_ON_EMPTY_BEANS
wasfalse
, and an empty Json Object would be created in that case.The text was updated successfully, but these errors were encountered: