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

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

@Hummmmmm

Description

@Hummmmmm
@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没生效。

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions