-
Notifications
You must be signed in to change notification settings - Fork 495
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
[BUG] JSONWriter.Feature.BrowserCompatible 导致 LocalDateTime 类型未按预期格式进行格式化处理 #2183
Comments
BrowserCompatible在Map里的作用等同于 WriteNonStringKeyAsString |
感谢解答,目前如果要对日期型 key,Fastjson 可以统一处理吗 |
我是觉得直接 toString 有点草率了,因为序列化之后可能就是String,应该获取序列化之后的结果,根据结果判定需不需要转 string |
我能想到的就是根据前后的 offset 偏移量取出序列化后的值,然后可能才去重写这部分序列化的结果 |
@wenshao 这个你在做了吗?我这边做了一版,试了下没问题,要不要我提个 PR 看下? |
rowstop
added a commit
to rowstop/fastjson2
that referenced
this issue
Jan 19, 2024
3 tasks
已经提了 PR,看下是否合适 |
rowstop
added a commit
to rowstop/fastjson2
that referenced
this issue
Jan 19, 2024
rowstop
added a commit
to rowstop/fastjson2
that referenced
this issue
Jan 22, 2024
3 tasks
wenshao
added a commit
that referenced
this issue
Jan 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
JSONWriter.Feature.BrowserCompatible 未对日期型数据进行格式化:
Map 中 键类型为 LocalDateTime 的数据
环境信息
重现步骤
JSONWriter.Feature.BrowserCompatible
作为序列化要求LocalDateTime
作为 key 的 Map 类型数据日期型 key 未按照指定格式进行格式化
的问题预期输出结果:
{"2024-01-12 19:55:57":1705060557443,"now":"2024-01-12 19:55:57"}
实际输出结果:
{"2024-01-12T19:55:57.443":1705060557443,"now":"2024-01-12 19:55:57"}
期待的正确结果
期望
JSONWriter.Feature.BrowserCompatible
不会影响日期格式的序列化yyyy-MM-dd HH:mm:ss
相关日志输出
附加信息
The text was updated successfully, but these errors were encountered: