当我使用1991-09-06来反序列化得到Date对象时,时间是CDT格式的,但是我用2019-09-06来反序列化,得到的时间就是CST格式的
qybjjes11#
是否可以提供下测试用例的信息呢?
7xzttuei2#
@Dataprivate static class JsonRequest { @JSONField(name = "create_time", format = "yyyy-MM-dd") private Date createTime;}@RequestMapping(value = "/json/v1", method = RequestMethod.GET)public ResponseEntity<Object> json() { String str = "{\"create_time\":\"1991-09-06\"}"; JsonRequest request = JSON.parseObject(str, JsonRequest.class); return new ResponseEntity < > (RestResultUtil.success(), HttpStatus.OK);}
@Data
private static class JsonRequest {
@JSONField(name = "create_time", format = "yyyy-MM-dd")
private Date createTime;
}
@RequestMapping(value = "/json/v1", method = RequestMethod.GET)
public ResponseEntity<Object> json() {
String str = "{\"create_time\":\"1991-09-06\"}";
JsonRequest request = JSON.parseObject(str, JsonRequest.class);
return new ResponseEntity < > (RestResultUtil.success(), HttpStatus.OK);
以上这段代码测试,使用的fastjson 版本1.2.47,无其他任何fastjson配置
2条答案
按热度按时间qybjjes11#
是否可以提供下测试用例的信息呢?
7xzttuei2#
是否可以提供下测试用例的信息呢?
以上这段代码测试,使用的fastjson 版本1.2.47,无其他任何fastjson配置