Suppose there is a Class Vehicle
with the following properties:
public id: number;
public modelId: number;
public modelName: string;
Now consider we have an object that looks like this
{id: 1, modelId: 1, modelName: "4"}
What is the best way to assign each property of this object to the respective property of the Vehicle class?
Avoiding manual assignment like below:
this.id = obj.id;
this.modelName = obj.modelName;
this.modelId = obj.modelId;