javascript - Mapping a JSON response to component model in TypeScript. -
i have angular 2 app returns json string. want take json string , map values model. from understanding, typescript model file supposed in mapping http response object - in case class classed 'customobject'. here's typescript model file created typescript recognize: export class customobject { public name: string; } here's json string looks (slightly modified chrome dev tools eliminate unnecessary variables): "{ "eventtype": 3, "description": "test description", "locationname": "defaultlocation", "name": "testname" }" i want take json string , map 'name' value ("testname" existing customobject's variable have declared in home.ts file null default: public activecustomobject: customobject = null; however, after executing http method retrieve json response (i expect variable 'activecustomobject' 'name' field set 'testnam