I've been searching high and low, but I can't seem to find the exact answer I need. Please inform me if my question has already been asked.
My goal is to construct an object in TypeScript that includes attributes of custom types.
The issue I'm facing is that my server supplies object data with URLs. I'm unsure how to handle this mapping situation. I hope I'm explaining it clearly enough – I'm still learning! By the way, I am working with Angular and TypeScript
Let me give you an example. This is what the object looks like:
export class Contact {
name : string;
address : {
street : string;
city : string;
}
}
However, the JSON retrieved from the server appears as follows:
{
"name" : "firstname lastname",
"address" : "http://localhost:5000/contacts/001"
}
If I use the address URL, I should receive the address in JSON format.
Thank you for your time!