Apex does not support annotation for serialization.
But, in this type of scenario, I always follows
public class TestClass
{
public string oldA { get; set; }
public string oldB { get; set; }
public string oldC { get; set; }
}
String jsonStr = JSON.serialize(objectTestClass);
jsonStr = jsonStr.replaceAll('"oldA":','"newA":');
You can use JSONGenerator to create the output yourself
Salesforce streamlines sales, marketing, and customer service operations. Our Salesforce online certification course provides in-depth knowledge, hands-on projects, and certification preparation to enhance your expertise in CRM solutions.