GitHub user MarcusJL opened a pull request:
https://github.com/apache/groovy/pull/433
Make json output configurable to not write entries with null values
Hi I would like to propose a simple solution for GROOVY-7858 / GROOVY-7780.
This is providing overriding methods with a boolean flag to skip writing
entries with null values for Closure Map and Expando.
If there are plans to have a more sophisticated solution e.g using some
more general configuration I would be glad to support on that.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/MarcusJL/groovy
make-JsonOutput-configurable-to-not-write-entries-with-null-values
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/groovy/pull/433.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #433
----
commit 73884040543cf7831149da10374eeb0863d1900c
Author: Marcus Lagemann <[email protected]>
Date: 2016-09-27T12:33:14Z
Add flag for writing null values to JsonOutput.
commit 5e19e3d5c553cd8fba5f46154e67fc89452048ce
Author: Marcus Lagemann <[email protected]>
Date: 2016-09-27T12:38:27Z
Add toString method with flag for writing null values.
commit 3b9c50f0104138f265ab42fcfcd804cc4f443e06
Author: Marcus Lagemann <[email protected]>
Date: 2016-09-28T16:27:15Z
Add tests for flag writeNullValues.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---