Skip to content
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

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants