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

Paul King closed GROOVY-8849.
-----------------------------

> Provide a way to change property names when converting Pojo to JSON
> -------------------------------------------------------------------
>
>                 Key: GROOVY-8849
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8849
>             Project: Groovy
>          Issue Type: New Feature
>          Components: JSON
>    Affects Versions: 2.5.0
>            Reporter: Raviteja Lokineni
>            Priority: Minor
>
> I want to be able to override with something like the annotation JsonProperty 
> to override how a property name should be serialized to Json. If the feature 
> is already there then please add documentation. For example:
> {code:java}
> @JsonProperty("test_one")
> int testOne
> @JsonProperty("test_two")
> int testTwo{code}
> More information on the example: 
> [Jackson-Annotations|https://github.com/FasterXML/jackson-annotations/wiki/Jackson-Annotations]
>  
> h1. Reproducible Code
> h2. Pojo.groovy
> {code:java}
> class Pojo {
>   int testOne
>   int testTwo
> }{code}
> h2. Sample Run:
> {code:java}
> JsonOutput.toJson(new Pojo(testOne: 1, testTwo: 1))
> // Output
> // ===> {"testTwo":1,"testOne":1}
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to