I have this JSON input:
{
"entityType": "person",
"id": 24285,
"properties": {
"firstName": "Zia",
"lastName": "Rus",
"email": "[email protected]",
"phoneNumber": null,
"requestingUserGuid": "Cugxxasod Daspohs, Uyowiye",
"generalReportReference": 244,
"employment": [
{
"employerName": "Avature",
"startDate": "01-Jan-2003",
"endDate": "04-Nov-2008",
"jobTitle": ""
},
{
"employerName": "Avature",
"startDate": "06-Jul-2012",
"endDate": "",
"jobTitle": ""
}
],
"supervisor": "Supervisor",
"education": [
{
"institutionName": "Universitate",
"major": "gead",
"degree": "gased",
"startDate": "01-Feb-2022",
"endDate": "01-Oct-2024"
}
],
"externalIdentifier": 24285,
"clientGuid": "6253d1c2-b02f-4513-8348-89db9b8ba449",
"productGuid": "e2f507b4-025c-439b-9ddb-833f9e537e60",
"applicantGuid": ""
}
}
So far I’ve managed to get the whole data transform as needed, but I’m missing the way to format the data fields to “YYYY-MM-DD” format.
I’ve seen ways to format the data fields, but most of them are by defaulting values or overwriting data.
The problem with those solutions, is that as you can see in the input JSON, I can have either one or multiple objects within the “employment” and “education” arrays, and I can either have an “EndDate” or not. Ergo, using the “defaulting data” solutions doesn’t work for me.
This is the JOLT I’m currently using to transform the data:
[
{
"operation": "shift",
"spec": {
"properties": {
"firstName": "firstName",
"lastName": "lastName",
"email": "email",
"phoneNumber": "phoneNumber",
"requestingUserGuid": "requestingUserGuid",
"generalReportReference": "generalReportReference",
"clientGuid": "clientGuid",
"productId": "productId",
"applicantGuid": "applicantGuid",
"externalIdentifier": "externalIdentifier",
"employment": {
"*": {
"employerName|endDate": {
"": null,
"*": {
"@1": "&4[&3].&2"
}
},
"*": {
"*": {
"@1": "&4[&3].&2"
}
}
}
},
"education": {
"*": {
"institutionName|registrarPhone|endDate": {
"": null,
"*": {
"@1": "&4[&3].&2"
}
},
"*": {
"*": {
"@1": "&4[&3].&2"
}
}
}
}
},
"education": {
"*": {
"~institutionName": "N/A",
"~registrarPhone": "(111) 111-1111"
}
},
"employment": {
"*": {
"~employerName": "N/A"
}
}
}
},
{
"operation": "modify-default-beta",
"spec": {
"employment": {
"*": {
"employerName": "N/A",
"firstNameUsed": "@(4,firstName)",
"lastNameUsed": "@(4,lastName)"
}
},
"education": {
"*": {
"institutionName": "N/A",
"registrarPhone": "(111) 111-1111"
}
}
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"employment": {
"*": {
"supervisor": "Supervisor"
}
}
}
}
]
I can’t see the way to be able to transform the “date” fields to the needed format.
Does anybody can help me with this one?
Thanks in advance!