Skip to content
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]LocalTime日期反序列化 #2310

Closed
zacat opened this issue Mar 9, 2024 · 5 comments
Closed

[BUG]LocalTime日期反序列化 #2310

zacat opened this issue Mar 9, 2024 · 5 comments
Assignees
Labels
bug Something isn't working fixed
Milestone

Comments

@zacat
Copy link

zacat commented Mar 9, 2024

fastjson 2.0.47

@Data
public static class TaskJobVO implements Serializable {
    LocalTime publishTime;
}

public static void main(String[] args) {
    String str = "{\"publishTime\": \"9:0:0\"}";
    TaskJobVO taskJobVO = JSONObject.parseObject(str,TaskJobVO.class);
    System.out.println(JSON.toJSONString(taskJobVO));
}

Exception in thread "main" com.alibaba.fastjson2.JSONException: expect ':', but 125, offset 17, character ", line 1, column 17, fastjson-version 2.0.47 {"publishTime": "9:0:0"}
at com.alibaba.fastjson2.JSONReaderASCII.readFieldNameHashCode(JSONReaderASCII.java:374)
at com.alibaba.fastjson2.reader.ORG_1_1_TaskJobVO.readObject(Unknown Source)
at com.alibaba.fastjson2.JSON.parseObject(JSON.java:786)
at com.alibaba.fastjson2.JSONObject.parseObject(JSONObject.java:1984)

@zacat zacat added the bug Something isn't working label Mar 9, 2024
@yanxutao89 yanxutao89 self-assigned this Mar 12, 2024
@yanxutao89
Copy link
Collaborator

9:0:0这个时间格式有误,换成09:00:00试试看

@yanxutao89 yanxutao89 removed their assignment Mar 12, 2024
@wenshao wenshao added this to the 2.0.48 milestone Mar 12, 2024
@wenshao
Copy link
Member

wenshao commented Mar 12, 2024

@yanxutao89 fastjson2支持自动识别日期格式,这种格式也是要支持的

@yanxutao89
Copy link
Collaborator

@yanxutao89 fastjson2支持自动识别日期格式,这种格式也是要支持的

那我看着改改

@wenshao
Copy link
Member

wenshao commented Mar 24, 2024

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.48-SNAPSHOT/ 问题已修复,请帮忙用2.0.48-SNAPSHOT验证,2.0.48正式版本预计在月末发布

@wenshao
Copy link
Member

wenshao commented Mar 25, 2024

@wenshao wenshao closed this as completed Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

3 participants