Annotation Interface JsonField


@Target({FIELD,PARAMETER,RECORD_COMPONENT}) @Retention(RUNTIME) public @interface JsonField
Русский: Аннотаций позволяет указать какое имя ключа в JSON должно соответствовать аннотированному полю, а также какой читатель и писатель использовать для поля
English: Annotations allows you to specify which key name in JSON should correspond to the annotated field, as well as which reader and writer to use for the field

Пример / Example:
 
 @Json
 record Example(@JsonField("val") String movie) { }
 
 

 { "val": "Movies" }
 
  • Element Details

    • value

      String value
      Returns:
      Русский: Имя ключа в JSON соответсвующее полю класса, по умолчанию равно имени поля
      English: Key name in JSON corresponding to the class field, by default equal to the field name
      Default:
      ""
    • writer

      Class<? extends JsonWriter<?>> writer
      Returns:
      Русский: Запись поля JSON, используемая для сериализации этого поля из JSON
      English: JSON field writer used for this field serialization from JSON
      Default:
      ru.tinkoff.kora.json.common.annotation.JsonField.DefaultWriter.class
    • reader

      Class<? extends JsonReader<?>> reader
      Returns:
      Русский: Устройство чтения полей JSON, используемое для десериализации этого поля в JSON
      English: JSON field reader used for this field deserialization in JSON
      Default:
      ru.tinkoff.kora.json.common.annotation.JsonField.DefaultReader.class