npm install @dhkatz/json-ts
Here is a complex example, hopefully could give you an idea of how to use it (for more on how to use, checkout [/test] which are unit test cases).
Note that initializing the class properties to defaults (such as undefined) is necessary because of how TypeScript compilation works.
Now here is what API server return, assume it is already parsed to JSON object.
Simply, just map it use following code. The mapping is based on
@JsonProperty decorator meta data.
If you want to reverse the action, from the other way round:
Remember to add: experimentalDecorators and emitDecoratorMetadata in your tsconfig.json. This is essential to enable decorator support for your typescript program. Example shown as followings: