I have this Jolt spec :
[
{
"operation": "shift",
"spec": {
"data": {
"*": {
"id": "[&1].id",
"Test_code": "[&1].Test_code",
"applyData": {
"Email": "[&2].Email",
"Address": "[&2].Address",
"Gender": "[&2].Gender",
"Date": "[&2].Date",
"Industry": "[&2].Industry",
"StartDate": "[&2].StartDate",
"TotalExperience": "[&2].TotalExperience"
}
}
}
}
}
]
and this input :
{
"data": [
{
"id": "124354",
"applicantId": "10775119",
"Test_code": "123454",
"applyData": {
"Email": "[email protected]",
"Address": null,
"Gender": "M",
"Date": "2024-01-28 23:23:39",
"Industry": "IT-Software",
"StartDate": "2013-04-01",
"TotalExperience": "11"
}
}
]
}
This works perfect, but if some of the values is missing, for example: Gender, I need to receive a response with the Gender set as null and in the same place. (I try set a default, null but it places the value at the bottom).
example input :
{
"data": [
{
"id": "124354",
"applicantId": "10775119",
"Test_code": "123454",
"applyData": {
"Email": "[email protected]",
"Address": null,
"Date": "2024-01-28 23:23:39",
"Industry": "IT-Software",
"StartDate": "2013-04-01",
"TotalExperience": "11"
}
}
]
}
desired output :
[
{
"id": "124354",
"Test_code": "123454",
"Email": "[email protected]",
"PermanentAddress": null,
"Gender": null,
"Date": "2024-01-28 23:23:39",
"Industry": "IT-Software",
"StartDate": "2013-04-01",
"TotalExperience": "11"
}
]
What you need is to add a default spec by including all the needed attributes such as