对日期的序列化:
一种方法是通过注解
@JSONField (format="yyyy-MM-dd HH:mm:ss")
public Date birthday;
另一种是通过SerializeConfig:
private static SerializeConfig mapping = new SerializeConfig();
private static String dateFormat;
static {
dateFormat = "yyyy-MM-dd HH:mm:ss";
mapping.put(Date.class, new SimpleDateFormatSerializer(dateFormat));
}
json字符串中使用单引号:
String text = JSON.toJSONString(object, SerializerFeature.UseSingleQuotes);
字段显示不同的key:
public class User {
@J