com.fasterxml.jackson.annotation

Annotation Type JsonIgnoreProperties



  • @Target(value={ANNOTATION_TYPE,TYPE,METHOD,CONSTRUCTOR,FIELD})
    @Retention(value=RUNTIME)
    public @interface JsonIgnoreProperties
    Annotation that can be used to either suppress serialization of properties (during serialization), or ignore processing of JSON properties read (during deserialization).

    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)
    

    Starting with 2.0, this 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.

    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element and Description
      boolean ignoreUnknown
      Property that defines whether it is ok to just ignore any unrecognized properties during deserialization.
      String[] value
      Names of properties to ignore.
    • Element Detail

      • value

        public abstract String[] value
        Names of properties to ignore.
        Default:
        {}
      • ignoreUnknown

        public abstract 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.

        Default:
        false

Copyright © 2014 FasterXML. All Rights Reserved.