I need to make an API call out with a JSON object. This has worked for me using data classes and using the restTemplate.postForEntity()
. The issue I'm running into is that the API is looking for a property of { "object": ... }
and I can't create a val in the data class of object because it is a reserved keyword.
I tried to override the toString method to output "RequestClass(\"object\"=$obj)"
but that didn't work. Is there another class that needs to be overridden with the restTemplate, or is there a different way to create a property with the same name as a reserved keyword?