为了账号安全,请及时绑定邮箱和手机立即绑定

无法将 JSON 值反序列化为类型

无法将 JSON 值反序列化为类型

牛魔王的故事 2021-07-05 12:55:30
我试图在我的网络服务中反序列化一个 post 请求,但我最终得到一个 HTTP 500 说javax.json.bind.JsonbException: Error deserialize JSON value into type: class [C. 我正在使用 Jackson 来处理 JSON 内容。这是我从 Postman 发送的 JSON 字符串:{"firstName":"FirstName","middleName":"middleName","lastName":"LastName","name":"SomeName","password":"$0meR@nd0m","creationTimeStamp":1533950475466}  这是我的 POJO :@XmlRootElementpublic class UserFormInterceptor   {    @Pattern(regexp = "^[\\S][\\p{L} .'-]+$") @Size(min = 2, max = 64) @NotEmpty @NotNull    private String firstName;    @Pattern(regexp = "^[\\S][\\p{L} .'-]+$") @Size(min = 2, max = 64)    private String middleName;    @Pattern(regexp = "^[\\S][\\p{L} .'-]+$") @Size(min = 2, max = 64) @NotEmpty @NotNull    private String lastName;    @Pattern(regexp = "^[a-zA-z][\\w]*$") @Size(min = 8, max = 64) @NotEmpty @NotNull    private String name;    @Pattern(regexp = "(?=.*?[A-Z]+)(?=.*?[0-9]+)(?=.*?[\\p{Punct}]+).*") @Size(min = 8, max = 64) @NotEmpty @NotNull    private char[] password;    @Positive @NotEmpty @NotNull    private long creationTimeStamp;    public UserFormInterceptor() {}    public UserFormInterceptor(@NotNull String name, @NotNull String password, @Positive long creationTimeStamp, @NotNull String firstName, String middleName, @NotNull String lastName) {        this.name = name;        this.password = password.toCharArray();        this.creationTimeStamp = creationTimeStamp;        this.firstName = firstName;        this.middleName = middleName;        this.lastName = lastName;    }    @NotNull    public String getFirstName() {        return firstName;    }    public void setFirstName(@NotNull String firstName) {        this.firstName = firstName;    }    public String getMiddleName() {        return middleName;    }    public void setMiddleName(String middleName) {        this.middleName = middleName;    }    @NotNull    public String getLastName() {        return lastName;    }    public void setLastName(@NotNull String lastName) {        this.lastName = lastName;    }
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 238 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信