Note that features can be set both through
ObjectMapper (as sort of defaults) and through
ObjectWriter.
In first case these defaults must follow "config-then-use" patterns
(i.e. defined once, not changed afterwards); all per-call
changes must be done using ObjectWriter.
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final int | |
| public static final SerializationFeature | CLOSE_CLOSEABLE
Feature that determines whether |
| public static final SerializationFeature | EAGER_SERIALIZER_FETCH
Feature that determines whether |
| public static final SerializationFeature | FAIL_ON_EMPTY_BEANS
Feature that determines what happens when no accessors are found for a type (and there are no annotations to indicate it is meant to be serialized). |
| public static final SerializationFeature | FAIL_ON_ORDER_MAP_BY_INCOMPARABLE_KEY
Feature that determines whether to intentionally fail when the mapper attempts to order map entries with incomparable keys by accessing the first key of the map. |
| public static final SerializationFeature | FAIL_ON_SELF_REFERENCES
Feature that determines what happens when a direct self-reference
is detected by a POJO (and no Object Id handling is enabled for it):
either a |
| public static final SerializationFeature | FAIL_ON_UNWRAPPED_TYPE_IDENTIFIERS
Feature that determines what happens when an object which
normally has type information included by Jackson is used
in conjunction with |
| public static final SerializationFeature | FLUSH_AFTER_WRITE_VALUE
Feature that determines whether |
| public static final SerializationFeature | INDENT_OUTPUT
Feature that allows enabling (or disabling) indentation
for the underlying generator, using the default pretty
printer configured for |
| public static final SerializationFeature | ORDER_MAP_ENTRIES_BY_KEYS
Feature that determines whether |
| public static final SerializationFeature | USE_EQUALITY_FOR_OBJECT_ID
Feature that determines whether Object Identity is compared using
true JVM-level identity of Object (false); or, |
| public static final SerializationFeature | WRAP_EXCEPTIONS
Feature that determines whether Jackson code should catch
and wrap |
| public static final SerializationFeature | WRAP_ROOT_VALUE
Feature that can be enabled to make root value (usually JSON Object but can be any type) wrapped within a single property JSON object, where key as the "root name", as determined by annotation introspector (esp. |
| public static final SerializationFeature | WRITE_CHAR_ARRAYS_AS_JSON_ARRAYS
Feature that determines how type |
| public static final SerializationFeature | WRITE_EMPTY_JSON_ARRAYS
Feature that determines whether Container properties (POJO properties with declared value of Collection or array; i.e. things that produce JSON arrays) that are empty (have no elements) will be serialized as empty JSON arrays (true), or suppressed from output (false). |
| public static final SerializationFeature | WRITE_SELF_REFERENCES_AS_NULL
Feature that determines what happens when a direct self-reference is detected by a POJO (and no Object Id handling is enabled for it): if enabled write that reference as null; if disabled, default behavior is used (which will try to serialize usually resulting in exception). |
| public static final SerializationFeature | WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED
Feature added for inter-operability (originally to work with oddities of so-called "BadgerFish" convention). |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | enabledByDefault()
Implements tools. Accessor for checking whether this feature is enabled by default. |
| public boolean | enabledIn(int flags)
Implements tools. Convenience method for checking whether feature is enabled in given bitmask |
| public int | getMask()
Implements tools. Returns bit mask for this feature instance |
| public static SerializationFeature | |
| public static SerializationFeature[] |
| _defaultState | back to summary |
|---|---|
| private final boolean _defaultState | |
| _mask | back to summary |
|---|---|
| private final int _mask | |
| CLOSE_CLOSEABLE | back to summary |
|---|---|
| public static final SerializationFeature CLOSE_CLOSEABLE Feature that determines whether Note only affects behavior with root objects, and not other objects reachable from the root object. Put another way, only one call will be made for each 'writeValue' call. Note in Jackson 2.x this used to only apply to Feature is disabled by default. | |
| EAGER_SERIALIZER_FETCH | back to summary |
|---|---|
| public static final SerializationFeature EAGER_SERIALIZER_FETCH Feature that determines whether Note that there should not be any need to normally disable this feature: only consider that if there are actual perceived problems. Feature is enabled by default. | |
| FAIL_ON_EMPTY_BEANS | back to summary |
|---|---|
| public static final SerializationFeature FAIL_ON_EMPTY_BEANS Feature that determines what happens when no accessors are found for a type (and there are no annotations to indicate it is meant to be serialized). If enabled (default), an exception is thrown to indicate these as non-serializable types; if disabled, they are serialized as empty Objects, i.e. without any properties.
Note that empty types that this feature has only effect on
those "empty" beans that do not have any recognized annotations
(like Feature is disabled by default as of Jackson 3.0 (in 2.x it was enabled). | |
| FAIL_ON_ORDER_MAP_BY_INCOMPARABLE_KEY | back to summary |
|---|---|
| public static final SerializationFeature FAIL_ON_ORDER_MAP_BY_INCOMPARABLE_KEY Feature that determines whether to intentionally fail when the mapper attempts to order map entries with incomparable keys by accessing the first key of the map. So depending on the Map implementation, this may not be the same key every time. If enabled, will simply fail by throwing an exception. If disabled, will not throw an exception and instead simply return the original map.
Note that this feature will apply only when configured to order map entries by keys, either
through annotation or enabling Feature is disabled by default. | |
| FAIL_ON_SELF_REFERENCES | back to summary |
|---|---|
| public static final SerializationFeature FAIL_ON_SELF_REFERENCES Feature that determines what happens when a direct self-reference
is detected by a POJO (and no Object Id handling is enabled for it):
either a Feature is enabled by default. | |
| FAIL_ON_UNWRAPPED_TYPE_IDENTIFIERS | back to summary |
|---|---|
| public static final SerializationFeature FAIL_ON_UNWRAPPED_TYPE_IDENTIFIERS Feature that determines what happens when an object which
normally has type information included by Jackson is used
in conjunction with Feature is enabled by default. | |
| FLUSH_AFTER_WRITE_VALUE | back to summary |
|---|---|
| public static final SerializationFeature FLUSH_AFTER_WRITE_VALUE Feature that determines whether Feature is enabled by default. | |
| INDENT_OUTPUT | back to summary |
|---|---|
| public static final SerializationFeature INDENT_OUTPUT Feature that allows enabling (or disabling) indentation
for the underlying generator, using the default pretty
printer configured for
Note that the default pretty printer is only used if
no explicit Feature is disabled by default. | |
| ORDER_MAP_ENTRIES_BY_KEYS | back to summary |
|---|---|
| public static final SerializationFeature ORDER_MAP_ENTRIES_BY_KEYS Feature that determines whether Feature is disabled by default. | |
| USE_EQUALITY_FOR_OBJECT_ID | back to summary |
|---|---|
| public static final SerializationFeature USE_EQUALITY_FOR_OBJECT_ID Feature that determines whether Object Identity is compared using
true JVM-level identity of Object (false); or, Note due to the way functionality is implemented, it is very important that
in addition to overriding
Feature is disabled by default; meaning that strict identity is used, not
| |
| WRAP_EXCEPTIONS | back to summary |
|---|---|
| public static final SerializationFeature WRAP_EXCEPTIONS Feature that determines whether Jackson code should catch
and wrap
Feature is enabled by default. | |
| WRAP_ROOT_VALUE | back to summary |
|---|---|
| public static final SerializationFeature WRAP_ROOT_VALUE Feature that can be enabled to make root value (usually JSON
Object but can be any type) wrapped within a single property
JSON object, where key as the "root name", as determined by
annotation introspector (esp. for JAXB that uses
Feature is disabled by default. | |
| WRITE_CHAR_ARRAYS_AS_JSON_ARRAYS | back to summary |
|---|---|
| public static final SerializationFeature WRITE_CHAR_ARRAYS_AS_JSON_ARRAYS Feature that determines how type Feature is disabled by default. | |
| WRITE_EMPTY_JSON_ARRAYS | back to summary |
|---|---|
| public static final SerializationFeature WRITE_EMPTY_JSON_ARRAYS Feature that determines whether Container properties (POJO properties with declared value of Collection or array; i.e. things that produce JSON arrays) that are empty (have no elements) will be serialized as empty JSON arrays (true), or suppressed from output (false).
Note that this does not change behavior of Note unlike other Note Since 2.8 there are better mechanism for specifying filtering; specifically
using Feature is enabled by default. | |
| WRITE_SELF_REFERENCES_AS_NULL | back to summary |
|---|---|
| public static final SerializationFeature WRITE_SELF_REFERENCES_AS_NULL Feature that determines what happens when a direct self-reference is detected
by a POJO (and no Object Id handling is enabled for it):
if enabled write that reference as null; if disabled, default behavior is
used (which will try to serialize usually resulting in exception).
But if Feature is disabled by default. | |
| WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED | back to summary |
|---|---|
| public static final SerializationFeature WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED Feature added for inter-operability (originally to work with oddities of
so-called "BadgerFish" convention).
Feature determines handling of single element When enabled, a POJO with array that normally looks like this:
{ "arrayProperty" : [ 1 ] }
will instead be serialized as
{ "arrayProperty" : 1 }
Note that this feature is counterpart to Feature is disabled by default, so that no special handling is done. | |
| SerializationFeature | back to summary |
|---|---|
| private SerializationFeature(boolean defaultState) | |
| enabledByDefault | back to summary |
|---|---|
| public boolean enabledByDefault() Implements tools. Doc from tools. Accessor for checking whether this feature is enabled by default.
| |
| enabledIn | back to summary |
|---|---|
| public boolean enabledIn(int flags) Implements tools. Doc from tools. Convenience method for checking whether feature is enabled in given bitmask
| |
| getMask | back to summary |
|---|---|
| public int getMask() Implements tools. Doc from tools. Returns bit mask for this feature instance
| |
| valueOf | back to summary |
|---|---|
| public static SerializationFeature valueOf(String name) | |
| values | back to summary |
|---|---|
| public static SerializationFeature[] values() | |