Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Feature.InitStringFieldAsEmpty 参数问题 #2387

@tungSing

Description

@tungSing

把json字符串转换为实体对象时:用了Feature.InitStringFieldAsEmpty参数,在1.2.29版本之前可以给对象正确赋值,之后的版本就无法赋值了。
对象实体:

public class TestEntity {
    private String id;
    private String ddd;
    private String name;
    //get set
}

测试main方法

public static void main(String[] args) {
    String jsonStr = "{id:\"ss\",ddd:\"sdfsd\",name:\"hh\"}";
    TestEntity news = JSON.parseObject(jsonStr, TestEntity.class, Feature.InitStringFieldAsEmpty);
    System.out.println(news.toString());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions