JSON to Javascript Class
Just assign to an instance: static from(json){ return Object.assign(new Student(), json); } So you can do: const student = Student.from({ name: “whatever” }); Or make it an instance method and leave away the assignemnt: applyData(json) { Object.assign(this, json); } So you can: const student = new Student; student.applyData({ name: “whatever” }); It could also be … Read more