Trying to extract the model object
from the JSON obtained through a http response call
.
The following JSON
represents the body of the http response
,
{
"dataType": "RWSupplier",
"partyName": "Lifecare Pharmaceuticals",
"partyShortName": null,
"partySecondaryName": null,
"partySecondaryShortName": null,
"sortingName": "Lifecare Pharma",
"mailingName": null,
"entityType": "SP",
"partyType": "OG",
"partySubType": null,
"extPartyId": null,
"comments": null,
"prGenderType": null,
"prBirthDate": null,
"prSalutation": null,
"statusCode": null,
"lastUpdateDate": "2017-03-06T04:30:00.000+0000",
"lastUpdateUser": "RwAdmin",
"tinNum": "33450701833",
"cstNum": "790052 dt. 4/4/2001",
"stNum": null,
"dlNum1": "5324/MIII/20B",
"dlNum2": "5205/MIII/21B",
"limitList": [ ],
"tagList": [ ],
"buId": "510",
"partyId": "SP001011001" }
An interface has been created for the above JSON
data as shown below,
export interface SupplierBrief {
dataType: string;
partyId: string;
buId: string;
partyName: string;
statusCode: string;
comments: string; }
Not all properties from the rest call are needed.
To optimize caching and reduce memory usage, unnecessary properties need to be omitted. The service is designed as follows,
return this.http.request(path, requestOptions).map((response: Response) => {
return response.json() as models.SupplierBrief;
});
However, the SupplierBrief
still includes all properties returned by the rest call.
There might be a misunderstanding with the concept of model objects. Any corrections or clarifications would be appreciated.