Annotation Interface JsonIncludeProperties


@Target({ANNOTATION_TYPE,TYPE,METHOD,CONSTRUCTOR,FIELD}) @Retention(RUNTIME) public @interface JsonIncludeProperties
Annotation that can be used to either only include serialization of properties (during serialization), or only include processing of JSON properties read (during deserialization).

Example:

 // to only include specified fields from being serialized or deserialized
 // (i.e. only include in JSON output; or being set even if they were included)
 @JsonIncludeProperties({ "internalId", "secretKey" })
 

Annotation can be applied both to classes and to properties. If used for both, actual set will be union of all includes: that is, you can only add properties to include, not remove or override. So you can not remove properties to include using per-property annotation.

Since:
2.12
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Helper class used to contain information from a single JsonIncludeProperties annotation, as well as to provide possible overrides from non-annotation sources.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Names of properties to include.
  • Element Details

    • value

      String[] value
      Names of properties to include.
      Default:
      {}