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

Allow TokenFilter to preserve empty #729

Merged

Commits on Dec 16, 2021

  1. Allow TokenFilter to preserve empty

    This creates two new method on `TokenFilter` which you can override to
    decide if empty arrays and objects should be included or excluded. An
    override like this, for example, will include all arrays and objects
    that were sent empty but strip any arrays or objects that were
    *filtered* to be empty:
    ```
            @OverRide
            public boolean includeEmptyArray(boolean contentsFiltered) {
                return !contentsFiltered;
            }
    
            @OverRide
            public boolean includeEmptyObject(boolean contentsFiltered) {
                return !contentsFiltered;
            }
    ```
    
    The default to preserve backwards compatibility is to always *exclude*
    empty objects.
    
    Closes FasterXML#715
    nik9000 committed Dec 16, 2021
    Copy the full SHA
    81ec871 View commit details
    Browse the repository at this point in the history