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.

@JSONField name 不支持 private 字段 #2866

@wj-io

Description

@wj-io

测试代码:
` @test
public void testPrivate() {
String json = "{"A1":1,"A2":2,"A3":3}";

	A a = JSON.parseObject(json, A.class, Feature.SupportNonPublicField);

	System.out.println(String.format("a1:%d,a2:%d,a3:%d",a.a1,a.A2,a.a3));
}

static class A{
	@JSONField(name="A1")
	int a1;
	int A2;
	@JSONField(name="A3")
	public int a3;
}

`

输出:
a1:0,a2:2,a3:3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions