@Target(value={ANNOTATION_TYPE,TYPE,METHOD,CONSTRUCTOR,FIELD}) @Retention(value=RUNTIME) public @interface JsonIgnoreProperties
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 | Optional Element and Description |
---|---|
boolean |
allowGetters
Property that can be enabled to allow "getters" to be used (that is,
prevent ignoral of getters for properties listed in
value() ). |
boolean |
allowSetters
Property that can be enabled to allow "setters" to be used (that is,
prevent ignoral of setters for properties listed in
value() ). |
boolean |
ignoreUnknown
Property that defines whether it is ok to just ignore any
unrecognized properties during deserialization.
|
String[] |
value
Names of properties to ignore.
|
public abstract String[] value
public abstract boolean ignoreUnknown
Does not have any effect on serialization.
public abstract boolean allowGetters
value()
).
This is commonly set to support defining "read-only" properties; ones
for which there is a getter, but no matching setter: in this case,
properties should be ignored for deserialization but NOT serialization.
Another way to think about this setting is that setting it to `true`
will "disable" ignoring of getters.
Default value is `false`, which means that getters with matching names will be ignored.
public abstract boolean allowSetters
value()
).
This could be used to specify "write-only" properties; ones
that should not be serialized out, but that may be provided in for
deserialization.
Another way to think about this setting is that setting it to `true`
will "disable" ignoring of setters.
Default value is `false`, which means that setters with matching names will be ignored.
Copyright © 2019 JBoss by Red Hat. All rights reserved.