Annotation Type JsonConverter


  • @Target(TYPE)
    @Retention(CLASS)
    public @interface JsonConverter
    JSON converter can be specified for class. It must have JSON_READER and JSON_WRITER which do the JSON conversion. This can be used for fine-tuning the serialization/deserialization process. Eg. java.time.Instant is not a supported type. After creating class such as
         @JsonConverter(target=Instant.class)
         public abstract InstantConverter {
             public static Instant read(JsonReader reader) { ... }
             public static void write(JsonWriter writer, Instant value) { ... }
             public static Instant default() { ... }
         }
     
    Date type will be one of the supported types.
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      java.lang.Class target
      For which class this converter applies.
    • Element Detail

      • target

        java.lang.Class target
        For which class this converter applies.
        Returns:
        target type