1. 程式人生 > >@jsonProperty 實現返回自定義屬性名字

@jsonProperty 實現返回自定義屬性名字

rop ring 前端 自定義 定義 實現 pan per span

  比如說前端需要返回userPic 這個字段,但是我們數據庫定義的是pic字段。

可以用@jsonProperty 來實現

public class User{
     @JsonProperty("pic")  
     String userPic; 
} 

@jsonProperty 實現返回自定義屬性名字