We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
在@JSONType 下配置了 JSONReader.Feature.FieldBased, 反序列化后priate字段依然是NULL。
@JSONType
JSONReader.Feature.FieldBased
请填写以下信息:
如何操作可以重现该问题:
第一步定义测试类
@JSONType(deserializeFeatures = {JSONReader.Feature.FieldBased}) public class TestClass { private String testField; public String getTestField() { return testField; } }
第二步建立一个简单的JSON文件testConfig.json
testConfig.json
{ "testField": "My Test" }
第三部写个main函数测试
public class test { public static void main(String[] args) throws Exception { TestClass test; try (InputStream stream = new BufferedInputStream(Files.newInputStream(Paths.get("testConfig.json")))) { test = JSON.parseObject(new String(stream.readAllBytes(), StandardCharsets.UTF_8), TestClass.class); } System.out.println(test.getTestField()); } }
输出结果是null. 而期待的结果应当是My Test.
null
My Test
The text was updated successfully, but these errors were encountered:
https://github.com/alibaba/fastjson2/releases/tag/2.0.49 问题已修复,请用新版本
Sorry, something went wrong.
No branches or pull requests
问题描述
在
@JSONType
下配置了JSONReader.Feature.FieldBased
, 反序列化后priate字段依然是NULL。环境信息
请填写以下信息:
重现步骤
如何操作可以重现该问题:
第一步定义测试类
第二步建立一个简单的JSON文件
testConfig.json
第三部写个main函数测试
期待的正确结果
输出结果是
null
. 而期待的结果应当是My Test
.The text was updated successfully, but these errors were encountered: