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

@JsonFormat日期反序列化错误 #1276

Closed
sobuh opened this issue Mar 24, 2023 · 1 comment
Closed

@JsonFormat日期反序列化错误 #1276

sobuh opened this issue Mar 24, 2023 · 1 comment
Labels
bug Something isn't working fixed
Milestone

Comments

@sobuh
Copy link

sobuh commented Mar 24, 2023

问题描述

简要描述您碰到的问题。

@Data
public class TestNotice implements Serializable {
    private Long id;
    @JsonFormat(
            pattern = "yyyy-MM-dd HH:mm"
    )
    private Date sendTime;
}

    public void test(){
        String s = "{\"id\":1,\"sendTime\":\"2023-03-24 11:10:11\"}";
        TestNotice notice = JSON.parseObject(s, TestNotice.class);
        System.out.printf(notice.toString());
    }

错误:Text '2023-03-24 11:10:11' could not be parsed, unparsed text found at index 16

期望: 能正常转换 或者 日期后面以0代替 2023-03-24 11:10:00

@sobuh sobuh added the bug Something isn't working label Mar 24, 2023
@wenshao wenshao added this to the 2.0.27 milestone Mar 25, 2023
@wenshao wenshao added the fixed label Mar 26, 2023
@wenshao
Copy link
Member

wenshao commented Apr 8, 2023

@wenshao wenshao closed this as completed Apr 8, 2023
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

2 participants