Example:
// to prevent specified fields from being serialized or deserialized
// (i.e. not include in JSON output; or being set even if they were included)
@JsonIgnoreProperties({ "internalId", "secretKey" })
// To ignore any unknown properties in JSON input without exception:
@JsonIgnoreProperties(ignoreUnknown=true)
Annotation can be applied both to classes and to properties. If used for both, actual set will be union of all ignorals: that is, you can only add properties to ignore, not remove or override. So you can not remove properties to ignore using per-property annotation.
| Modifier and Type | Class and Description |
|---|---|
| public static class | JsonIgnoreProperties.
Helper class used to contain information from a single |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: True if getters should be allowed (i.e. NOT ignored); false if getters are to be ignoredProperty that can be enabled to allow "getters" to be used (that is,
prevent ignoral of getters for properties listed in |
| public boolean | Returns: True if setters should be allowed (i.e. NOT ignored); false if setters are to be ignoredProperty that can be enabled to allow "setters" to be used (that is,
prevent ignoral of setters for properties listed in |
| public boolean | Returns: True if any and all unknown properties are to be ignored without exceptions (or other special handling); false otherwise.Property that defines whether it is ok to just ignore any unrecognized properties during deserialization. |
| public String[] |
| allowGetters | back to summary |
|---|---|
| public boolean allowGetters() Property that can be enabled to allow "getters" to be used (that is,
prevent ignoral of getters for properties listed in Default value is `false`, which means that getters with matching names will be ignored.
| |
| allowSetters | back to summary |
|---|---|
| public boolean allowSetters() Property that can be enabled to allow "setters" to be used (that is,
prevent ignoral of setters for properties listed in Default value is `false`, which means that setters with matching names will be ignored.
| |
| ignoreUnknown | back to summary |
|---|---|
| public boolean ignoreUnknown() Property that defines whether it is ok to just ignore any unrecognized properties during deserialization. If true, all properties that are unrecognized -- that is, there are no setters or creators that accept them -- are ignored without warnings (although handlers for unknown properties, if any, will still be called) without exception. Does not have any effect on serialization.
| |
| value | back to summary |
|---|---|
| public String[] value() Names of properties to ignore. | |
JsonIgnoreProperties
annotation, as well as to provide possible overrides from non-annotation sources.
| Modifier and Type | Field and Description |
|---|---|
| protected final boolean | |
| protected final boolean | |
| protected final Set | _ignored
Names of properties to ignore. |
| protected final boolean | |
| protected final boolean | |
| protected static final JsonIgnoreProperties. | EMPTY
Default instance has no explicitly ignored fields, does not ignore unknowns, does not explicitly allow getters/setters (that is, ignorals apply to both), but does use merging for combining overrides with base settings |
| private static final long |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private static Set | |
| private static boolean | |
| private static boolean | |
| private static Set | |
| public static JsonIgnoreProperties. | |
| public static JsonIgnoreProperties. | empty()
Accessor for default instances which has "empty" settings; that is:
|
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. Indicates whether some other object is "equal to" this one. |
| public Set | findIgnoredForDeserialization()
Method called to find names of properties to ignore when used for
serialization: functionally
same as |
| public Set | findIgnoredForSerialization()
Method called to find names of properties to ignore when used for
serialization: functionally
same as |
| public static JsonIgnoreProperties. | |
| public static JsonIgnoreProperties. | |
| public static JsonIgnoreProperties. | |
| public static JsonIgnoreProperties. | |
| public boolean | |
| public boolean | |
| public Set | |
| public boolean | |
| public boolean | |
| public int | |
| public static JsonIgnoreProperties. | merge(JsonIgnoreProperties.
Helper method that will try to combine values from two |
| public static JsonIgnoreProperties. | |
| protected Object | |
| public String | |
| public Class | valueFor()
Implements com. Introspection method that may be used to find actual annotation that may be used as the source for value instance. |
| public JsonIgnoreProperties. | |
| public JsonIgnoreProperties. | |
| public JsonIgnoreProperties. | |
| public JsonIgnoreProperties. | |
| public JsonIgnoreProperties. | |
| public JsonIgnoreProperties. | |
| public JsonIgnoreProperties. | |
| public JsonIgnoreProperties. | |
| public JsonIgnoreProperties. | |
| public JsonIgnoreProperties. | |
| public JsonIgnoreProperties. | |
| public JsonIgnoreProperties. | withOverrides(JsonIgnoreProperties.
Mutant factory method that merges values of this value with given override values, so that any explicitly defined inclusion in overrides has precedence over settings of this value instance. |
| _allowGetters | back to summary |
|---|---|
| protected final boolean _allowGetters | |
| _allowSetters | back to summary |
|---|---|
| protected final boolean _allowSetters | |
| _ignored | back to summary |
|---|---|
| protected final Set<String> _ignored Names of properties to ignore. | |
| _ignoreUnknown | back to summary |
|---|---|
| protected final boolean _ignoreUnknown | |
| _merge | back to summary |
|---|---|
| protected final boolean _merge | |
| EMPTY | back to summary |
|---|---|
| protected static final JsonIgnoreProperties. Default instance has no explicitly ignored fields, does not ignore unknowns, does not explicitly allow getters/setters (that is, ignorals apply to both), but does use merging for combining overrides with base settings | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| Value | back to summary |
|---|---|
| protected Value(Set<String> ignored, boolean ignoreUnknown, boolean allowGetters, boolean allowSetters, boolean merge) | |
| _asSet | back to summary |
|---|---|
| private static Set | |
| _empty | back to summary |
|---|---|
| private static boolean _empty(Set<String> ignored, boolean ignoreUnknown, boolean allowGetters, boolean allowSetters, boolean merge) | |
| _equals | back to summary |
|---|---|
| private static boolean _equals(JsonIgnoreProperties. | |
| _merge | back to summary |
|---|---|
| private static Set | |
| construct | back to summary |
|---|---|
| public static JsonIgnoreProperties. Factory method that may be used (although is NOT the recommended way)
to construct an instance from a full set of properties. Most users would
be better off starting by | |
| empty | back to summary |
|---|---|
| public static JsonIgnoreProperties. Accessor for default instances which has "empty" settings; that is:
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| findIgnoredForDeserialization | back to summary |
|---|---|
| public Set Method called to find names of properties to ignore when used for
serialization: functionally
same as | |
| findIgnoredForSerialization | back to summary |
|---|---|
| public Set Method called to find names of properties to ignore when used for
serialization: functionally
same as | |
| forIgnoredProperties | back to summary |
|---|---|
| public static JsonIgnoreProperties. | |
| forIgnoredProperties | back to summary |
|---|---|
| public static JsonIgnoreProperties. | |
| forIgnoreUnknown | back to summary |
|---|---|
| public static JsonIgnoreProperties. | |
| from | back to summary |
|---|---|
| public static JsonIgnoreProperties. | |
| getAllowGetters | back to summary |
|---|---|
| public boolean getAllowGetters() | |
| getAllowSetters | back to summary |
|---|---|
| public boolean getAllowSetters() | |
| getIgnored | back to summary |
|---|---|
| public Set | |
| getIgnoreUnknown | back to summary |
|---|---|
| public boolean getIgnoreUnknown() | |
| getMerge | back to summary |
|---|---|
| public boolean getMerge() | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| merge | back to summary |
|---|---|
| public static JsonIgnoreProperties. Helper method that will try to combine values from two | |
| mergeAll | back to summary |
|---|---|
public static JsonIgnoreProperties.
| |
| readResolve | back to summary |
|---|---|
| protected Object readResolve() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| valueFor | back to summary |
|---|---|
| public Class Implements com. Doc from com. Introspection method that may be used to find actual annotation that may be used as the source for value instance.
| |
| withAllowGetters | back to summary |
|---|---|
| public JsonIgnoreProperties. | |
| withAllowSetters | back to summary |
|---|---|
| public JsonIgnoreProperties. | |
| withIgnored | back to summary |
|---|---|
| public JsonIgnoreProperties. | |
| withIgnored | back to summary |
|---|---|
| public JsonIgnoreProperties. | |
| withIgnoreUnknown | back to summary |
|---|---|
| public JsonIgnoreProperties. | |
| withMerge | back to summary |
|---|---|
| public JsonIgnoreProperties. | |
| withoutAllowGetters | back to summary |
|---|---|
| public JsonIgnoreProperties. | |
| withoutAllowSetters | back to summary |
|---|---|
| public JsonIgnoreProperties. | |
| withoutIgnored | back to summary |
|---|---|
| public JsonIgnoreProperties. | |
| withoutIgnoreUnknown | back to summary |
|---|---|
| public JsonIgnoreProperties. | |
| withoutMerge | back to summary |
|---|---|
| public JsonIgnoreProperties. | |
| withOverrides | back to summary |
|---|---|
| public JsonIgnoreProperties. Mutant factory method that merges values of this value with given override
values, so that any explicitly defined inclusion in overrides has precedence over
settings of this value instance. If no overrides exist will return | |