Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

@JSONType注解的serialzeFeatures属性无效 #1649

Closed
Hummmmmm opened this issue Dec 14, 2017 · 1 comment
Closed

@JSONType注解的serialzeFeatures属性无效 #1649

Hummmmmm opened this issue Dec 14, 2017 · 1 comment
Labels
Milestone

Comments

@Hummmmmm
Copy link

Hummmmmm commented Dec 14, 2017

@JSONType(serialzeFeatures = {SerializerFeature.WriteNullStringAsEmpty,SerializerFeature.WriteMapNullValue})
public class Apple {

    // @JSONField(serialzeFeatures = {SerializerFeature.WriteNullStringAsEmpty, SerializerFeature.WriteMapNullValue})
    private String color;
    private String productCity;
    private int size;

    public String getColor() {
        return color;
    }

    public Apple setColor(String color) {
        this.color = color;
        return this;
    }

    public int getSize() {
        return size;
    }

    public Apple setSize(int size) {
        this.size = size;
        return this;
    }

    public String getProductCity() {
        return productCity;
    }

    public Apple setProductCity(String productCity) {
        this.productCity = productCity;
        return this;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

    public static void main(String[] args) {
        System.out.println(JSON.toJSONString(new Apple()));
    }
}

在类上加上@jsontype注解,注释掉字段color的注解,serialzeFeatures没生效。

@wenshao wenshao added this to the 1.2.43 milestone Dec 16, 2017
@wenshao wenshao added the bug label Dec 16, 2017
wenshao added a commit that referenced this issue Dec 16, 2017
@wenshao
Copy link
Member

wenshao commented Dec 16, 2017

https://github.com/alibaba/fastjson/releases/tag/1.2.43
问题已修复,请使用新版本

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants