Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

JSON.toJSONString不同overload对Date的处理不一致 #367

Closed
marsqing opened this issue Jul 3, 2015 · 2 comments
Closed

JSON.toJSONString不同overload对Date的处理不一致 #367

marsqing opened this issue Jul 3, 2015 · 2 comments
Milestone

Comments

@marsqing
Copy link

marsqing commented Jul 3, 2015

如以下几个方法不会调用serializer.config(SerializerFeature.WriteDateUseDateFormat, true);
toJSONString(Object object)
toJSONString(Object object, SerializeConfig config, SerializeFilter filter, SerializerFeature... features)

而以下会调用serializer.config(SerializerFeature.WriteDateUseDateFormat, true);
toJSONString(Object object, SerializeFilter filter, SerializerFeature... features)

不一一列举。会导致不同签名的toJSONString方法序列化Date字段的结果不一致。对于Java问题不大,跨语言的时候可能会有问题。

@LQZYC
Copy link
Contributor

LQZYC commented Jul 6, 2015

这个SerializerFeature.WriteDateUseDateFormat需要的时候加上就可以了吧 如果对日期要求不是很严格 每次不管什么样子的序列化都加上这个也不大好吧

@wenshao wenshao added this to the 1.2.9 milestone Apr 13, 2016
@wenshao
Copy link
Member

wenshao commented Apr 13, 2016

修改了实现,如果没有调用toJSONStringWithDateFormat,就不会自动配置WriteDateUseDateFormat了。

@wenshao wenshao closed this as completed Apr 13, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants