JSTEP 2 - FasterXML/jackson-future-ideas GitHub Wiki
Jackson 3 default setting, behavior changes
Author
Tatu Saloranta (@cowtowncoder)
Version history
- 2024-03-01: minor update on default changes
- 2022-09-18: add proposed default change to Date/Times-as-timestamps
DeserializationFeature
s - 2019-02-10: create first version from earlier notes
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 changes.
Prior Work
Note that at the time of writing (February 2019), some of the work has already been done. Attempt is made to include such changes in this plan as if work was being planned, even if initial changes have been made.
jackson-core
defaults
Changes to JsonReadFeature
JsonWriteFeature
JsonWriteFeature.ESCAPE_FORWARD_SLASHES
now defaults totrue
StreamReadConstraints
DEFAULT_MAX_DEPTH
to 500 (from 1,000) (see core#1233)
StreamWriteConstraints
DEFAULT_MAX_DEPTH
to 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)
jackson-databind
defaults
Changes to MapperFeature
First, following deprecated features are to be 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 features
And defaults to following features will be changed:
SORT_PROPERTIES_ALPHABETICALLY
: default totrue
(false
really doesn't make much sense since it is unstable, and arbitrary based on JVM/JDK)
DeserializationFeature
Changes to defaults:
READ_ENUMS_USING_TO_STRING
: default totrue
(instead offalse
that relies onname()
)FAIL_ON_UNKNOWN_PROPERTIES
: default tofalse
? (TOP REQUEST by users)FAIL_ON_UNEXPECTED_VIEW_PROPERTIES
: default totrue
(as per databind#437)
Other changes, potential:
- Although all features still make sense, would make sense to try to combine some, and/or create new type of configuration to use instead of feature -- for example
FAIL_xxx
are all kind of similar.DeserializationFail
, or "check" or... ?READ_xxx_as_yyy
, similarlyACCEPT_xxx_as_yyy
, similarly
SerializationFeature
Changes to defaults:
FAIL_ON_EMPTY_BEANS
: default tofalse
- Writing date/time values as ISO-8601 Strings instead of (Java style) timestamps
WRITE_DATES_AS_TIMESTAMPS
: change default tofalse
to serialize as ISO-8601 StringWRITE_DATE_KEYS_AS_TIMESTAMPS
: RETAIN default offalse
-- no changeWRITE_DURATIONS_AS_TIMESTAMPS
: change default tofalse
to serialize as ISO-8601 String
Other changes, potential:
- Most if not all features seem to make sense, but there are groups that could use unification of some kind
FAIL_ON_xxx
WRITE_xxx_as_yyy
Changes to Date/Time defaults
- Disable
lenient
setting (that is: default to "strict") - Check defaults of date/time handling
Misc other default setting, behavior changes
JsonNode
handling
DecimalNode
creation viaJsonNodeFactory
: default to NOT truncating trailing zeroes (minimal trimming), becauseJsonNode
should by default expose content as close to way it came.