Skip to content

[BUG] 2.0.34版本对于反序列这个配置无效 JSON.config(JSONReader.Feature.FieldBased); #1619

Closed
@Jick-study

Description

问题描述

2.0.33版本如果使用JSON.config(JSONReader.Feature.FieldBased); 可以在反序列化的类上不增加@Setter,但是2.0.34用这个无效
当某个类上没有@Setter注解时,结果为null.

环境信息

  • JDK信息: jdk17
  • 版本信息:2.0.34

重现步骤

如何操作可以重现该问题:
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class SendEmailResponse {

private String msg;

private boolean success;

private Long id;

}

public static void main(String[] args) {
JSON.config(JSONReader.Feature.FieldBased);
String json = "{"msg":"send successfully!","success":true,"id":111111}";
SendEmailResponse sendEmailResponse = JSON.parseObject(json, SendEmailResponse.class);
System.out.println(sendEmailResponse.isSuccess());
}

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions