@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);

上一篇:Django JSONField/HStoreField SQL 注入漏洞 (CVE-2019-14234)


下一篇:Android源码之Gallery专题研究(1)