You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Guillaume Laforge (Jira)" <ji...@apache.org> on 2023/09/05 08:41:00 UTC

[jira] [Updated] (GROOVY-11167) JsonOutput should handle Records like POGOs

     [ https://issues.apache.org/jira/browse/GROOVY-11167?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Laforge updated GROOVY-11167:
---------------------------------------
    Description: 
The following assertion fails:
{code:java}
import groovy.json.JsonOutput
record Person(String name) {}
assert JsonOutput.toJson([new Person('Guillaume')]) == '[{"name":"Guillaume"}]'{code}
All records are serialised as {{{}}}

I would expect records to be serialised as normal POGOs or Maps, etc.

  was:
The following assertion fails:

 
{code:java}
import groovy.json.JsonOutput
record Person(String name) {}
assert JsonOutput.toJson([new Person('Guillaume')]) == '[{"name":"Guillaume"}]'{code}
 

All records are serialized 


> JsonOutput should handle Records like POGOs
> -------------------------------------------
>
>                 Key: GROOVY-11167
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11167
>             Project: Groovy
>          Issue Type: Improvement
>          Components: JSON
>    Affects Versions: 4.0.14, 3.0.19
>            Reporter: Guillaume Laforge
>            Priority: Major
>
> The following assertion fails:
> {code:java}
> import groovy.json.JsonOutput
> record Person(String name) {}
> assert JsonOutput.toJson([new Person('Guillaume')]) == '[{"name":"Guillaume"}]'{code}
> All records are serialised as {{{}}}
> I would expect records to be serialised as normal POGOs or Maps, etc.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)