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]”is“开头的boolean类型属性值丢失 #1754

Closed
luckytao opened this issue Aug 16, 2023 · 2 comments
Closed

[BUG]”is“开头的boolean类型属性值丢失 #1754

luckytao opened this issue Aug 16, 2023 · 2 comments
Labels
bug Something isn't working fixed
Milestone

Comments

@luckytao
Copy link

luckytao commented Aug 16, 2023

问题描述

简要描述您碰到的问题。
我把fastjson从1.x升级到2.x最新版本2.0.39,发现在JSONObject的toJavaObject方法时,boolean类型属性如果时is开头的值丢失。

环境信息

请填写以下信息:

  • OS信息: win11
  • JDK信息: jdk1.8
  • 版本信息:2.0.39

重现步骤

public class AttributeEntity {
private String name;
private String type;
private boolean isRequired;
private boolean isMultivalued;
...........
}

public class JsonTest {

public static void main(String[] args) {
    JSONObject json = new JSONObject();
    json.put("name","test");
    json.put("isRequired",true);
    json.put("isMultivalued","true");
    AttributeEntity obj = json.toJavaObject(AttributeEntity.class, JSONReader.Feature.SupportSmartMatch);
    System.out.println(obj.toString());
}

}

@luckytao luckytao added the bug Something isn't working label Aug 16, 2023
@luckytao luckytao changed the title [BUG]”is“开头的boolean类型属性不能反序列化 [BUG]”is“开头的boolean类型属性值丢失 Aug 16, 2023
@wenshao
Copy link
Member

wenshao commented Aug 18, 2023

@wenshao wenshao added this to the 2.0.40 milestone Aug 18, 2023
@wenshao wenshao added the fixed label Aug 18, 2023
@wenshao
Copy link
Member

wenshao commented Sep 3, 2023

https://github.com/alibaba/fastjson2/releases/tag/2.0.40
问题已修复,请用新版本

@wenshao wenshao closed this as completed Sep 3, 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