I retrieve employee data from SAP in a json format. I am able to deserialize this into a C# object. I then need to put some of this data into another object and post it to a webservice, but the field names and structure is different.
How do I efficiently translate one "employee object" to a different object?
Instead of doing this (entirely fictional code)
sapEmployee = await SAPService.GetSomeEmployee();
Employee employee = new Employee();
employee.Name = sapEmployee.FullName;
employee.Emailaddress = sapEmployee.Email;
employee.Phone = sapEmployee.Phone.Mobile;
//etc
SomeClass.PostToTheOtherWebService(employee);
What is the principle of doing something like this and what is good architecture? Some sort of intermediate classes or field mapping configuration?