I am currently developing an angular application and need to send data to a post API. The JSON structure I am working with is as follows:
{
"name": "julie",
"id": 1,
"PersonalDetails": {
"homeId": 23,
"homeName": "Julie Home"
},
"OfficialDetails": {
"OfficeId": 45,
"OfficeAddress": "Near townhall"
}
}
Within my component, I need to populate this data by setting values using variables in the component and then sending it to my post API method. As I anticipate needing to send more models in the future with similar structures but different data, I am considering creating an interface. However, being new to TypeScript, I am unsure of how to proceed.
Could you advise on the best approach to creating a model for this data and setting values? How should I go about creating a model/interface and populating its values?