-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
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
fastjson2 与jackson注解存在冲突 #716
Comments
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.13-SNAPSHOT/ 如果要禁用JacksonAnnotation识别,需要显式配置,有两种方法: 1. 通过JVM启动参数配置
2. 通过直接调用JSONFactory#setUseJacksonAnnotation方法JSONFactory.setUseJacksonAnnotation(false); |
thank you |
经过验证在使用 JSONFactory.setUseJacksonAnnotation(false) 之后,已经不再忽略JsonIgnore相关字段; JacksonAnnotation的识别似乎对 @JsonIgnore(value = false) 的行为和Jackson不一致,value为false时表示不再忽略该字段,不过目前并不需要fastjson去识别Jackson的注解,已满足需求 |
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.13-SNAPSHOT/ |
https://github.com/alibaba/fastjson2/releases/tag/2.0.13 |
已经解决了 |
问题描述
当类中字段使用注解类 com.fasterxml.jackson.annotation.JsonIgnore,及@.JsonIgnore 时 转换成json时字段也会忽略该字段;如果父级使用了改注解 @JsonIgnore(value = false) 也无法恢复该字段的json序列化
环境信息
重现步骤
import com.fasterxml.jackson.annotation.JsonIgnore;
@DaTa
public class Test {
Test conf = new Test();
conf.setId(1L);
System.out.println(JSON.toJSONString(conf));
期待的正确结果
{“id”:1}
注解不应该受其他库干扰
实际结果
{}
The text was updated successfully, but these errors were encountered: