I am working with two separate objects below,
let response = {
offer: {
custom_fields: {
job_title: 'engineer'
},
starts_at: 'test',
job_post: 'test'
}
}
let defaultFieldMapping = {
"$.engagementData.title": {
default: "Software Engineer",
path: "$.offer.custom_fields.job_title",
fieldName: 'Title'
},
"$.engagementData.startDateUTC": {
default: null,
path: "$.offer.starts_at",
},
}
I need to create a new object with the following expected result
let expectedResult = [
{
externalFieldId: '$.offer.custom_fields.job_title',
integrationFieldId: '$.engagementData.title'
},
{
externalFieldId: '$.offer.starts_at',
integrationFieldId: '$.engagementData.startDateUTC'
},
{
externalFieldId: '$.offer.job_post',
integrationFieldId: ''
},
]
The integrationFieldId is left as an empty string because it does not exist in the defaultFieldMapping path column.