JSTEP 2 - FasterXML/jackson-future-ideas GitHub Wiki
(Back to JSTEP page)
Jackson 3 default settings, behavior changes
Author
Tatu Saloranta (@cowtowncoder)
Version history
- 2025-10-11: Add
TokenStreamFactory.Feature.INTERN_PROPERTY_NAMES - 2025-08-27: Some notes on Date/Time handling changes.
- 2025-07-24: Update wrt revert of default change for
JsonWriteFeature.ESCAPE_FORWARD_SLASHESdefault - 2025-05-12: Update wrt CBOR read/write feature defaults - @cowtowncoder
- 2025-05-05: Update wrt
DeserializationFeature.FAIL_ON_UNEXPECTED_VIEW_PROPERTIESrevert - @cowtowncoder - 2025-05-03: Update wrt
MonthSerializerandMonthDeserializerbehavior change - @JooHyukKim - 2025-04-08: Added
DateTimeFeature.ONE_BASED_MONTHS- @cowtowncoder - 2025-04-06: Added
MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS- @cowtowncoder - 2025-02-05: Updates wrt
XmlWriteFeaturedefault changes - @cowtowncoder - 2025-02-01: Update wrt
SerializationFeature.WRITE_DATES_AS_TIMESTAMPSdefault change - @cowtowncoder - 2025-01-31: Update wrt
SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPSdefault change - @cowtowncoder - 2025-01-29: Update wrt
DeserializationFeature.FAIL_ON_TRAILING_TOKENSdefault change - @cowtowncoder - 2025-01-19: Add Kotlin module proposed change links - @cowtowncoder
- 2024-07-21:
DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIESdefault changed - @cowtowncoder - 2024-06-06:
DeserializationFeature.READ_ENUMS_USING_TO_STRING,SerializationFeature.WRITE_ENUMS_USING_TO_STRINGdefaults changed - @cowtowncoder - 2024-05-31:
MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORSdefault changed - @cowtowncoder - 2019-02-10: create first version from earlier notes - @cowtowncoder
Status
Mostly complete for 3.0.0-rc6 (2025-07-18) but will remain technically open until 3.0.0 release
Overview
During Jackson 2.x development, certain default settings have proven either problematic by development team, or non-intuitive/non-optimal by users: latter indicated both by filed issues and comments on mailing list discussions. Since default settings and behavior are important part of the public API, changes have had to wait until major version change in most cases.
This document details proposed/planned as well as implemented changes.
Changes to jackson-core defaults
JsonReadFeature
No changes
JsonWriteFeature
No changes
- NOTE: initially planned change to
JsonWriteFeature.ESCAPE_FORWARD_SLASHESdefaults were rolled back in3.0.0-rc7
StreamReadConstraints
DEFAULT_MAX_DEPTHto 500 (from 1,000) (see core#1233)
StreamWriteConstraints
DEFAULT_MAX_DEPTHto 500 (from 1,000) (see core#1233)
StreamReadFeature
USE_FAST_DOUBLE_PARSER: enabled by default in 3.0 (see core#1231)USE_FAST_BIG_NUMBER_PARSER: enabled by default in 3.0 (see core#1231)
StreamWriteFeature
USE_FAST_DOUBLE_WRITER: enabled by default in 3.0 (see core#1231)
TokenStreamFactory.Feature
INTERN_PROPERTY_NAMES: disabled by default in 3.0 (see core#378
Changes to jackson-databind defaults
MapperFeature
First, following deprecated features have been removed from 3.0:
USE_STD_BEAN_NAMING: should always be enabled, no need for old slightly differing algorithmAUTO_DETECT_xxx: old limited settings superceded by more granular settings -- frees up 5 featuresAUTO_DETECT_CREATORSAUTO_DETECT_FIELDSAUTO_DETECT_GETTERSAUTO_DETECT_IS_GETTERSAUTO_DETECT_SETTERS
And defaults to following features have been changed:
ALLOW_FINAL_FIELDS_AS_MUTATORS: default tofalse-- while enabling may be useful sometimes, it confuses users in general and is unlikely to even work with future JDKs/JVMsDEFAULT_VIEW_INCLUSION: default tofalse: has been requested by users and change initially approvedUSE_GETTERS_AS_SETTERS: default tofalse-- earlier default was based on JAXB but is quite confusing for usersSORT_PROPERTIES_ALPHABETICALLY: default totrue(falsereally doesn't make much sense since it is unstable, and arbitrary based on JVM/JDK)
Changes, potential:
OVERRIDE_PUBLIC_ACCESS_MODIFIERS: default tofalsesince benefits of enabling seem small if not non-existent with 3.0
DeserializationFeature
Changes completed:
FAIL_ON_UNKNOWN_PROPERTIES: default tofalse(TOP REQUEST by users) databind#493READ_ENUMS_USING_TO_STRING: default totrue(instead offalsethat relies onname()) databind#4566- NOTE: this was further renamed/moved as
EnumFeature.READ_ENUMS_USING_TO_STRING(via databind#5079)
- NOTE: this was further renamed/moved as
FAIL_ON_NULL_FOR_PRIMITIVES: default totrue(databind#4858)- Setting to
falsewould allowing coercion from JSON null into Java int, long and so on. For some users, and especially on "low null" languages like Kotlin, such coercion is rarely expected.
- Setting to
FAIL_ON_TRAILING_TOKENS: default totrue(databind#3406)
Changes planned but not made (or were reverted):
FAIL_ON_UNEXPECTED_VIEW_PROPERTIES: default remainsfalsefor 3.0- Feature added for databind#437, via databind#4275
SerializationFeature
Changes completed:
WRITE_ENUMS_USING_TO_STRING: default totrue(to keep symmetry between itsDeserializationFeature.READ_ENUMS_USING_TO_STRINGcounterpart) databind#4567- NOTE: this was further renamed/moved as
EnumFeature.WRITE_ENUMS_USING_TO_STRING(via databind#5080)
- NOTE: this was further renamed/moved as
FAIL_ON_EMPTY_BEANS: default tofalsedatabind#3070FAIL_ON_ORDER_MAP_BY_INCOMPARABLE_KEY: was added in 2.19. Changed default in 3.0 via databind#4781WRITE_DURATIONS_AS_TIMESTAMPS: change default tofalseto serialize as ISO-8601 String -- databind#4846- Note: renamed/moved as
DateTimeFeature.WRITE_DURATIONS_AS_TIMESTAMPS
- Note: renamed/moved as
- Writing date/time values as ISO-8601 Strings instead of (Java style) timestamps
WRITE_DATES_AS_TIMESTAMPS: change default tofalseto serialize as ISO-8601 String -- databind#4845- Note: renamed/moved as
DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS
- Note: renamed/moved as
WRITE_DATE_KEYS_AS_TIMESTAMPS: RETAIN default offalse-- no change- Note: renamed/moved as
DateTimeFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS
- Note: renamed/moved as
DateTimeFeature
Changes completed:
ONE_BASED_MONTHS: default totrue(3.0.0-rc3)- Moved entries from
DeserializationFeature:ADJUST_DATES_TO_CONTEXT_TIME_ZONE,READ_DATE_TIMESTAMPS_AS_NANOSECONDS - Moved entries from
SerializationFeature(WRITE_DATE_xxxand similar)
Changes to other format backend defaults
Changes to CBOR defaults
CBORReadFeature:CBORWriteFeature:CBORWriteFeature.ENCODE_USING_STANDARD_NEGATIVE_BIGINT_ENCODING: change default totrueCBOR#582
Changes to XML defaults
XmlWriteFeature
Changes to Date/Time defaults
NOTE: see above for databind DateTimeFeature changes (including replacing some SerializationFeature/DeserializationFeatures, as well as default setting changes:
Changes to defaults, handling:
- The default rendering for UTC in 3.0 is now a trailing
Z, not a+00as in 2.x.
Proposed (but not completed) changes:
- Disable
lenientsetting (that is: default to "strict")
Changes to jackson-module-kotlin defaults
Kotlin module has a few proposed/accept changes.
- Discussion of changes to default behavior in
Jackson 3.0(Parent/Overall discussion) -- and specific sub-issues:
Misc other default setting, behavior changes
JsonNode handling
DecimalNodecreation viaJsonNodeFactory: default to NOT truncating trailing zeroes (minimal trimming), becauseJsonNodeshould by default expose content as close to way it came.
MonthSerializer and MonthDeserializer behavior change (databind#5127)
- In 2.x,
java.time.Monthwas handled as plainEnumand was applied withEnum-related handling such asEnumFeature.WRITE_ENUMS_USING_INDEXorEnumFeature.WRITE_ENUMS_USING_TO_STRING. - Starting 3.x, along with
java-timemerging todatabindmodule, it's now handled like regular date/time classes, defaulting to number as value.
Using Jackson 2.x defaults in Jackson 3
For projects that still rely on Jackson 2.x behavior, Jackson 3 provides a builder method that configures an ObjectMapper with the older defaults where possible.
To create an ObjectMapper using Jackson 2.x defaults:
ObjectMapper mapper = JsonMapper.builderWithJackson2Defaults().build();
Note: This method does not (and cannot) fully replicate every Jackson 2.x default. Verify behavior in your application before relying on it.