Is there a way to control the casing of the parameter name? eg: FirstName instead of firstName? I've put variable name as FirstName but it still show up as firstName
Yes, it is possible. Instead of using firstName variable in the class Person, you can use FirstName instead. In video ruclips.net/video/WGc5jI_unk0/видео.html, change line no 26
@@testingtooling That what I thought too but doesn't seem to work as such. for some reason, it camelCase when using Class class Applicant { String FirstName String LastName String DatOfBirth public Applicant(String Fname, String Lname, String Dob){ this.FirstName = Fname this.LastName = Lname this.DatOfBirth = Dob } } Applicant Sample = new Applicant("fName", "LName", "1976-08-11") def theJson = new JsonBuilder(Sample).toPrettyString() println(theJson); println(new JsonBuilder(FirstName:"name")) Output: { "datOfBirth": "1976-08-11", "firstName": "fName", "lastName": "LName" } {"FirstName":"name"}
very informative and thank you
Thank you for the feedback
Is there a way to control the casing of the parameter name? eg: FirstName instead of firstName? I've put variable name as FirstName but it still show up as firstName
Yes, it is possible. Instead of using firstName variable in the class Person, you can use FirstName instead. In video ruclips.net/video/WGc5jI_unk0/видео.html, change line no 26
If you face an issue, please reach out. Happy to hop on call
@@testingtooling That what I thought too but doesn't seem to work as such. for some reason, it camelCase when using Class
class Applicant {
String FirstName
String LastName
String DatOfBirth
public Applicant(String Fname, String Lname, String Dob){
this.FirstName = Fname
this.LastName = Lname
this.DatOfBirth = Dob
}
}
Applicant Sample = new Applicant("fName", "LName", "1976-08-11")
def theJson = new JsonBuilder(Sample).toPrettyString()
println(theJson);
println(new JsonBuilder(FirstName:"name"))
Output:
{
"datOfBirth": "1976-08-11",
"firstName": "fName",
"lastName": "LName"
}
{"FirstName":"name"}
{
"cargos": [{
"kind": "a",
"type": "b",
"objects": [{
"identifier": "xyz"
}]
},
{
"kind": "a",
"type": "d",
"objects": [{
"_identifier": "xyz"
}]
}
]
}
create groovy