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 
    Exclude the property from serialization, deserialization or both.
    static @interface 
    Specify types to generate JsonAdapters for.
    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
    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

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

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

      Default:
      Match
    • 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:
      ""