Annotation Type Json


@Retention(CLASS) @Target(TYPE) public @interface Json
Marks a type for JSON support.

Examples:



   @Json(naming = LowerHyphen)
   public class Customer ...

 


   @Json
   public record Product( ... )

 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Define one or more alternative names for a property accepted during deserialization.
    static @interface 
    Exclude the property from serialization, deserialization or both.
    static @interface 
    Specify types to generate JsonAdapters for.
    static @interface 
    Deprecated.
    - migrate to Json.Alias.
    static @interface 
    Mark this Class as a MixIn Type that can add Jsonb Annotations on the specified type.
    static enum 
    The naming convention that we can use for a given type.
    static @interface 
    Override the json property name.
    static @interface 
    Marks a String field as containing raw JSON content.
    static @interface 
    Specify the subtypes that a given type can be represented as.
    static @interface 
    Container of all the concrete SubType's that an interface type or abstract type can be represented as.
    static @interface 
    Annotate a Map<String,Object> field to hold unmapped json properties.
    static @interface 
    Mark a method on an Enum that provides the json value.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    When set to true on deserialization keys are matched insensitive to case.
    Specify the naming convention to use for the properties on this type.
    When @Json.SubType is used this specifies the name of the property field that holds the type name (discriminator value).
  • Element Details

    • naming

      Json.Naming naming
      Specify the naming convention to use for the properties on this type.

      By default, the naming used is Json.Naming.Match

      Default:
      Match
    • typeProperty

      String typeProperty
      When @Json.SubType is used this specifies the name of the property field that holds the type name (discriminator value).

      This defaults to @type when unspecified.

      Default:
      "@type"
    • caseInsensitiveKeys

      boolean caseInsensitiveKeys
      When set to true on deserialization keys are matched insensitive to case.
      Default:
      false