I have a RestApi which sends me the response in a Json Format which has for example a address object which then holds the address1, address2, city etc. So i created an interface in my app which holds the definition of these objects like
export interface ISurveyResponseDetail {
docID?: string;
permission?: string;
property?: IProperty;
surveyID?: string;
}
export interface IProperty {
address1?: string;
address2?: string;
city?: string;
state?: string;
zip?: string;
then in my ts file i want to use a data adapter to map my response into this interface. But i am not sure how i would the property Object of type IProperty and then be able to assign the values
static adaptSurveyResponseDetail(data): ISurveyResponseDetail {
if (data) {
return {
property:
// address1 _.get(data, 'property.address1', null),
// city _.get(data, 'property.city', null),
docID: _.get(data, 'docID', null),
permission: _.get(data, 'permission', null),
surveyID: _.get(data, 'survey_id', null),
};
} else {
return data;
}
}