groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-7858) Make JsonBuilder configurable to not write entries with null values
Date Thu, 29 Sep 2016 15:22:20 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-7858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15533062#comment-15533062
] 

ASF GitHub Bot commented on GROOVY-7858:
----------------------------------------

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 <marcus.lagemann@smaato.com>
Date:   2016-09-27T12:33:14Z

    Add flag for writing null values to JsonOutput.

commit 5e19e3d5c553cd8fba5f46154e67fc89452048ce
Author: Marcus Lagemann <marcus.lagemann@smaato.com>
Date:   2016-09-27T12:38:27Z

    Add toString method with flag for writing null values.

commit 3b9c50f0104138f265ab42fcfcd804cc4f443e06
Author: Marcus Lagemann <marcus.lagemann@smaato.com>
Date:   2016-09-28T16:27:15Z

    Add tests for flag writeNullValues.

----


> Make JsonBuilder configurable to not write entries with null values
> -------------------------------------------------------------------
>
>                 Key: GROOVY-7858
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7858
>             Project: Groovy
>          Issue Type: Improvement
>          Components: JSON
>    Affects Versions: 2.4.5
>            Reporter: Marcus Lagemann
>            Assignee: John Wagenleitner
>            Priority: Trivial
>
> {{JsonBuilder}} (and underlying {{JsonOutput}} ) is writing entries with null values
when serializing to Json String:
> {code:javascript}
>  {"key1": "value",
>   "key2": null}
> {code}
> There should be a flag or configuration value to change this behaviour and skip writing
entries where the values are null.
> {code:javascript}
>  {"key1": "value"}
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message