-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.util.Date字段反序列化可以支持unixtime #392
Comments
能提供一个你期待结果的代码,现在是支持的,我看哪里漏了 |
public static void main(String[] args) {
String date1 = JSONObject.of("date1", 1654053162).toString();
System.out.println("date1 = " + date1);
Date date = JSON.parseObject(date1, Test.class).getDate1();
SimpleDateFormat sf = new SimpleDateFormat("yyyy-HH-dd HH:mm:dd");
System.out.println(sf.format(date));
}
@Data
class Test{
@JSONField(format = "unixtime")
private Date date1;
} 如果是数值类型,直接当毫秒处理了 还是我使用的有问题 |
问题已经修复,请帮忙用2.0.6-SNAPSHOT版本验证,2.0.6正式版预计6月5日前发布 |
验证数值型是可以成功的,比如:{"date1":1654134285} 对于unixtime反序列化为date,是否可以基于位数与是否全是数字的方式进行判断,不用format配置 未配置format 测试代码如下:
} @DaTa |
请描述您的需求或者改进建议
java.util.Date字段反序列化可以支持unixtime,目前直接转换成1970年
请描述你建议的实现方案
format支持unixtime
The text was updated successfully, but these errors were encountered: