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
当vm设置-Dfastjson2.parser.safeMode=true后不支持AutoType没问题,但是设置了JSONReader.autoTypeFilter后,转换的对象也会丢失子类的属性,请问怎么回事? Filter AUTO_TYPE_FILTER = JSONReader.autoTypeFilter("org.example.model"); String json = JSON.toJSONString(versionInfo, JSONWriter.Feature.WriteClassName); System.out.println(json); VersionInfo versionInfo1 = JSON.parseObject(bytes,VersionInfo.class,AUTO_TYPE_FILTER); System.out.println(JSON.toJSONString(versionInfo1)); 打印结果: {"appVersion":{"@type":"org.example.model.CustomerAppVersion","appVersion":"v1.1.0","platform":1},"userName":"Allen","version":"v1"} {"appVersion":{"appVersion":"v1.1.0"},"userName":"Allen","version":"v1"} 反序列化丢失了platform属性。
The text was updated successfully, but these errors were encountered:
add issue #1503
278b25f
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.33-SNAPSHOT/ 问题已修复,请帮忙用2.0.33-SNAPSHOT版本验证。
Sorry, something went wrong.
https://github.com/alibaba/fastjson2/releases/tag/2.0.33 请用新版本
No branches or pull requests
当vm设置-Dfastjson2.parser.safeMode=true后不支持AutoType没问题,但是设置了JSONReader.autoTypeFilter后,转换的对象也会丢失子类的属性,请问怎么回事?
Filter AUTO_TYPE_FILTER = JSONReader.autoTypeFilter("org.example.model");
String json = JSON.toJSONString(versionInfo,
JSONWriter.Feature.WriteClassName);
System.out.println(json);
VersionInfo versionInfo1 = JSON.parseObject(bytes,VersionInfo.class,AUTO_TYPE_FILTER);
System.out.println(JSON.toJSONString(versionInfo1));
打印结果:
{"appVersion":{"@type":"org.example.model.CustomerAppVersion","appVersion":"v1.1.0","platform":1},"userName":"Allen","version":"v1"}
{"appVersion":{"appVersion":"v1.1.0"},"userName":"Allen","version":"v1"}
反序列化丢失了platform属性。
The text was updated successfully, but these errors were encountered: