其他分享
首页 > 其他分享> > @JSONField

@JSONField

作者:互联网

@Data
@AllArgsConstructor
@NoArgsConstructor
class Nation extends BaseSerializable {
@JSONField(defaultValue = "汉族", name= "name")
private String na_me;

@JSONField(ordinal = 1, name = "DRESS")
private String dress;

@JSONField(ordinal = 3, format = "yyyy-MM-dd")
private Date celebrateHoliday;
@JSONField(ordinal = 2, name = "number")
private Integer num;
}

Nation nationBean1 = Nation.builder().name("汉族").build();
String str = JSON.toJSONString(nationBean1);
System.out.println(str);

标签:ordinal,name,private,Nation,JSONField,String
来源: https://www.cnblogs.com/yunger/p/15097916.html