I’m facing some issue in for loop while creating an object from array of object.I have an object as this in node js app:
I am working for rest api have to get the response properly.
[
{
"issuer_id": 2639,
"job_title": "Sales Manager",
"hr-contact": "9767865459",
"adress": "bangalore",
"image": "http://localhost:3003/public/uploads/company-logos/undefined",
"getEmployerDetail": [
{
"issuer_id": 2639,
"Field_of_activity": "Jobs",
"id": 111,
"Section": "Communes",
"Content": "Mühlwald",
"foa_section_content_id": 111
},
{
"issuer_id": 2639,
"Field_of_activity": "Jobs",
"id": 112,
"Section": "Communes",
"Content": "Wolkenstein in Gröden",
"foa_section_content_id": 112
},
{
"issuer_id": 2639,
"Field_of_activity": "Jobs",
"id": 113,
"Section": "Communes",
"Content": "Schnals",
"foa_section_content_id": 113
},
{
"issuer_id": 2639,
"Field_of_activity": "Jobs",
"id": 150,
"Section": "Professional field",
"Content": "Marketing, Graphics, PR",
"foa_section_content_id": 150
},
{
"issuer_id": 2639,
"Field_of_activity": "Jobs",
"id": 162,
"Section": "Branch",
"Content": "Banks, Finance, Insurance",
"foa_section_content_id": 162
},
{
"issuer_id": 2639,
"Field_of_activity": "Jobs",
"id": 215,
"Section": "Benefits",
"Content": "Enrolment programme",
"foa_section_content_id": 215
},
{
"issuer_id": 2639,
"Field_of_activity": "Jobs",
"id": 220,
"Section": "Benefits",
"Content": "Childcare",
"foa_section_content_id": 220
}
]
}
]
I want to return object like this which contains all the Material as array, Name and there value in array of object like this:
I want to get result using for loop.
[
{
"issuer_id": 2639,
"job_title": "Sales Manager",
"hr-contact": "9767865459",
"adress": "bangalore",
"image": "http://localhost:3003/public/uploads/company-logos/undefined",
"employmentType": [
{
"id": 198,
"Employment_type": "Freelancer"
}
],
"professionalField": [
{
"id": 150,
"Professional_field": "Marketing, Graphics, PR"
}
],
"benefits": [
{
"id": 215,
"Benefits": "Enrolment programme"
},
{
"id": 219,
"Benefits": "Canteen"
},
{
"id": 220,
"Benefits": "Childcare"
},
{
"id": 221,
"Benefits": "Employee events"
},
{
"id": 222,
"Benefits": "Employee mobile phone"
},
{
"id": 223,
"Benefits": "Employee notebook"
},
{
"id": 224,
"Benefits": "Employee bonuses"
}
],
"branch": [
{
"id": 162,
"Branch": "Banks, Finance, Insurance"
}
],
"communes": [],
"positionLevel": [],
"skillSets": [],
"languageSkills": [],
"skillRepository": [],
"jobCluster": [],
"jobClusterDescription": []
}
]
2
Answers