I have 1 object coming from the server with multiple properties in which I want to hydrate it into a new object, changing the name of 1 property and keeping the rest.
Code:
JSON: { UserId: 1, Name: "Woo", Age: 10 }
The format of the object I want it in:
var newObj = {}
newObj.id = jsonObj.UserId;
//Everything property below here is the same. How can i prevent writing this code?
newObj.Name = jsonObj.Name;
newObj.Age = jsonObj.Age;
What I'm doing is based on this answer, trying to parse some json into a format that requires me to change the name of 1 property.