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

SerializerFeature.WriteNullBooleanAsFalse does not work when asm is disabled and PascalNameFilter is applied #1635

Closed
greenlaw110 opened this issue Dec 7, 2017 · 3 comments
Milestone

Comments

@greenlaw110
Copy link

Java source

public class GH426 extends GithubIssueBase {

    public static class Foo {
        public String name;
        public int BarCount;
        public Boolean flag;

        public Foo(String name, int barCount) {
            this.name = name;
            BarCount = barCount;
        }
    }

    public static void main(String[] args) {
        SerializeConfig.getGlobalInstance().setAsmEnable(false);
        Foo foo = new Foo("Name", 5);
        String json = JSON.toJSONString(foo, new PascalNameFilter(), SerializerFeature.WriteNullBooleanAsFalse);
        System.out.println(json);
    }
}

Running the above code got the following output:
image

Note it works when asm is enabled or PascalNameFilter is removed.

@greenlaw110
Copy link
Author

Update

It looks like SerializerFeature.WriteNonStringValueAsString works neither

@wenshao wenshao added this to the 1.2.42 milestone Dec 7, 2017
wenshao added a commit that referenced this issue Dec 8, 2017
@wenshao
Copy link
Member

wenshao commented Dec 8, 2017

bug fixed. The next version will be released at the end of the month

@wenshao
Copy link
Member

wenshao commented Dec 14, 2017

https://github.com/alibaba/fastjson/releases/tag/1.2.42
bug fixed, please use new versionn.

@wenshao wenshao closed this as completed Dec 14, 2017
wenshao added a commit that referenced this issue Jan 1, 2018
wenshao added a commit that referenced this issue Jul 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants