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? 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
在@JSONField 下配置了 JSONReader.Feature.FieldBased, 反序列化后priate字段依然是NULL。
@JSONField
JSONReader.Feature.FieldBased
请填写以下信息:
如何操作可以重现该问题:
第一步定义测试类
public class TestClass { @JSONField(deserializeFeatures = { JSONReader.Feature.FieldBased }) 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:
fix support FieldBased feature on field for issue #2350
652cb53
8f1c3c6
fix support FieldBased feature on field for issue #2350 (#2357)
cf53480
* fix support FieldBased feature on field for issue #2350 * fix support FieldBased feature on field for issue #2350 * fix checkstyle
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.48-SNAPSHOT/ 问题已修复,请帮忙用2.0.48-SNAPSHOT验证,2.0.48正式版本预计在月末发布
Sorry, something went wrong.
非常感谢! 问题修复已验证。
https://github.com/alibaba/fastjson2/releases/tag/2.0.48 请用新版本
yanxutao89
No branches or pull requests
问题描述
在
@JSONField
下配置了JSONReader.Feature.FieldBased
, 反序列化后priate字段依然是NULL。环境信息
请填写以下信息:
重现步骤
如何操作可以重现该问题:
第一步定义测试类
第二步建立一个简单的JSON文件
testConfig.json
第三部写个main函数测试
期待的正确结果
输出结果是
null
. 而期待的结果应当是My Test
.The text was updated successfully, but these errors were encountered: