i have response from backendthat i am trying to map it to interface but its always throws interface properties undefined like in below case Envelop always coming undefined. Any idea what is implemented wrong here ?
interface.ts
export interface IResult {
Envelop: Envelope;
}
export interface Envelope {
$: $;
Header: string;
Body: Body;
}
export interface $ {
"xmlns:soapenv": string;
}
export interface Body {
"trk:TrackResponse": TrackShipment;
}
main.ts
public after(data: IResult){
const result = data.Envelop.Body
const response: any = result;
return response;
}
Json data from backend
"soapenv:Envelope": {
"$": {
"xmlns:soapenv": "http"
},
"soapenv:Header": "",
"soapenv:Body": {
"some test Data"
}
}
const result = data.Envelop.Bodyshould look more like:const result = data['soapenv:Envelope'];Envelop,HeaderandBodyinterface properties don't match the keys in the returned JSON."soapenv:Body": { "some test Data" }is not valid json. It should be a key, value pair.const result = data['soapenv:Envelope'];but i want to map it to interface and get it from thereEnvelopcan someone provide correct answer please