How to keep Letter Case in JSON Converter method in Groovy?
Another option is to use a gson serializer
with annotations: https://google.github.io/gson/apidocs/com/google/gson/annotations/SerializedName.html
@Grab('com.google.code.gson:gson:2.7+')
import com.google.gson.Gson
import com.google.gson.annotations.SerializedName
class Client {
@SerializedName("Name")
String name
@SerializedName("Birthdate")
Date birthdate
}
def client = new Client(name: 'John', birthdate: new Date())
def strJson = new Gson().toJson(client)
println strJson