Jackson
EasyYapi supports Jackson annotations for JSON serialization customization.
Supported Annotations
Field Name
@JsonProperty— Custom field name@JsonNaming— Naming strategy
Field Ignore
@JsonIgnore— Ignore a field@JsonIgnoreProperties— Ignore multiple fields
Type Handling
@JsonFormat— Date/time format@JsonDeserialize/@JsonSerialize— Custom serializer
Inclusion
@JsonInclude— Include strategy
Example
java
public class User {
@JsonProperty("user_name")
private String name;
@JsonIgnore
private String password;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdAt;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String nickname;
}Configuration
Use the following rules to customize Jackson integration:
- json.rule.convert — Type conversion
- json.rule.enum.convert — Enum conversion
- field.ignore — Field ignoring