I am facing a challenge in Angular 9/Typescript while trying to iterate through the object response from my JSON data. Despite searching for solutions, I haven't found any that work for me. In my JSON, there is a section called "details" which contains sub-sections like "personal details", "work details", and "phone number". My goal is to extract each node within these sections dynamically in order to create a dynamic form. Any help would be greatly appreciated.
Note: I am attempting to achieve this using a function in .ts rather than utilizing *ngFor.
"details":
{
"personalDetails":
{
"title" :"Personal Details",
"fields":
[
{
"label":"First Name",
"type":"text",
"validation":
{
"required":true
}
},
{
"label":"Last Name",
"type":"text",
"validation":
{
"required":true
}
}
]
},
"workDetails":
{
"title" :"Work Related Details",
"fields":
[
{
"label":"Company Name",
"type":"text",
"validation":
{
"required":true
}
},
{
"label":"Date Of Joining",
"type":"date",
"validation":
{
"required":true
}
}
]
},
"phoneNumberDetails":
{
"title" :"Phone Number Details",
"fields":
[
{
"label":"Primary Contact",
"type":"number",
"validation":
{
"required":true
}
},
{
"label":"Secondary Contact",
"type":"number",
"validation":
{
"required":false
}
}
]
}