How to load from a JSON file to Javascript class object (Javascript/Typescript Serialization)
It is a common requirement to load a nested Javascript class from a JSON file. Sometimes you want to send the JSON across a network and load it back to a Javascript class. For better clarity, let us understand the difference between a Javascript class instance and an Object. Take this class for example: This is a class that draws a rectangle on the canvas class Rectangle{ public x:number=0 public y:number=0 public width:number=0 public height:number=0 public draw(ctx:CanvasRenderingContext2D) { ctx.