Advertisement

Spring: Jackson-Annotations 官方文档

阅读量:

文章结构概览

  • 一、引言
    • 二、@JsonProperty 注解
    • 三、@JsonIgnore 注解
    • 四、@JsonInclude 注解
    • 五、@JsonFormat 注解
    • 六、@JsonCreator 和 @JsonProperty(应用于构造函数)
    • 七、@JsonTypeName 和 @JsonTypeInfo 注解
    • 八、@JsonIgnoreProperties 注解
    • 九、@JsonSerialize 注解
    • 十、@JsonDeserialize 注解

一、介绍

Jackson-annotations 作为 Jackson 库的组成部分,其功能在于提供多种注解,用以调节 Java 对象与 JSON 数据格式之间转换时的序列化及反序列化操作流程。

二、@JsonProperty注解应用

用于确立 Java 类属性与 JSON 字段之间对应关系的配置方式。

复制代码
    public class User {  
    @JsonProperty("user_name")  
    private String name;  
    
    // getters and setters  
    }
    
    

在前述示例中,所涉及的 Java

全部评论 (0)

还没有任何评论哟~