fastjson icon indicating copy to clipboard operation
fastjson copied to clipboard

1.2.83 升级 2.0.21 值丢失?

Open xiangyunup opened this issue 2 years ago • 2 comments

import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.annotation.JSONField; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Setter;

@Setter public class TestVo implements Serializable {

@JsonIgnore
private String test1;

@JsonIgnore
@JSONField(serialize = false)
private String test2;
  
 public String getTest1() {
          if(StringUtil.isNotEmpty(test2)){
              return test2;
          }
          return test1;
  }

public static void main(String[] args) {
        TestVo test = new TestVo();
        test.setTest2("a");
        System.out.println(JSON.toJSONString(test));
       // 1.2.83 输出 {"test1":"a"} 2.0.21 输出 {}
}

}

xiangyunup avatar Dec 29 '22 07:12 xiangyunup

https://github.com/alibaba/fastjson2/issues 可以提issue到这里么?

wenshao avatar Jan 28 '23 15:01 wenshao

https://github.com/alibaba/fastjson2/issues 可以提issue到这里么?

因为一些原因,导致刚看到,已经从新提交。

https://github.com/alibaba/fastjson2/issues/1840#issue-1885607029

xiangyunup avatar Sep 07 '23 10:09 xiangyunup