jackson注解使用

jackson常用注解


1、类注解,忽略部分字段

@JsonIgnoreProperties(value = { "name" }) 

2、@JsonIgnore忽略单个字段,可标注在属性或者方法上


3、@JsonProperty(value="create") 为属性定义返回的json名称


4、@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")  序列化属性时


5、@JsonSerialize(using=JsonDate2Serializer.class)    指定序列化处理类,指定类集成 JsonSerializer并重写serialize方法

发布了9 篇原创文章 · 获赞 6 · 访问量 516

猜你喜欢

转载自blog.csdn.net/happygan520/article/details/43950733
今日推荐