You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/01/04 20:25:00 UTC

[jira] [Commented] (GROOVY-5169) JsonOutput.toJson(object) is not returning expected results

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

Eric Milles commented on GROOVY-5169:
-------------------------------------

https://github.com/apache/groovy/pull/1670/commits/f6ab340292465749edac4dec377fe526aded8d28

> JsonOutput.toJson(object) is not returning expected results
> -----------------------------------------------------------
>
>                 Key: GROOVY-5169
>                 URL: https://issues.apache.org/jira/browse/GROOVY-5169
>             Project: Groovy
>          Issue Type: Bug
>          Components: JSON
>    Affects Versions: 1.8.4, 2.4.1
>            Reporter: James Sumners
>            Assignee: Eric Milles
>            Priority: Minor
>              Labels: properties
>         Attachments: 0001-bugfix.patch, 0002_patch.txt, GroovyConsole_output.png, MetaClassImpl.java, MetaClassImpl.patch, json_test.groovy, screenshot.png
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Consider the attached Groovy script. It defines two classes. Each has public properties explicitly defined. When I send the resulting objects to JsonOutput.toJson(), I expect the public properties of the object to be serialized into the JSON output. This is not working as expected. The only properties that get serialized are those created via "def propName" and those that seem to have getter methods (this in not actually the case).
> Attached is a screenshot of GroovyConsole running the attached script.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)