I run a JS API request as below:
const options = {
url: `https://${bundle.authData.server}.boostlingo.com/api/web/profile/read-only-form/${bundle.inputData.interpreterId}`,
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': `Bearer ${bundle.authData.token}`
},
params: {
}
}
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;
// You can do any parsing you need for results here before returning them
return results;
});
And the response is an array that looks like this:
{
"fieldPolicyId": 4,
"fields": [
{
"fieldId": 21,
"fieldTypeId": 2,
"fieldFormatTypeId": 3,
"includeInPrintView": false,
"label": "Note (visible to LSP only)",
"errorMessage": null,
"description": "Here PMs can add additional notes to Interpreter profiles. Such notes remain hidden from Interpreter view",
"value": null
},
{
"fieldId": 2,
"fieldTypeId": 1,
"fieldFormatTypeId": 3,
"includeInPrintView": false,
"label": "NAATI CPN No",
"errorMessage": null,
"description": "Unique NAATI identification number",
"value": "CPN6FZ66L"
},
{
"fieldId": 233,
"fieldTypeId": 1,
"fieldFormatTypeId": 3,
"includeInPrintView": false,
"label": "NAATI No",
"errorMessage": null,
"description": "NAATI No if only accredited and CPN not available",
"value": null
},
{
"fieldId": 150,
"fieldTypeId": 1,
"fieldFormatTypeId": 3,
"includeInPrintView": false,
"label": "NAATI Certification expires on (DD-MM-YYYY):",
"errorMessage": null,
"description": "(DD-MM-YYYY)",
"value": null
},
{
"fieldId": 3,
"fieldTypeId": 5,
"fieldFormatTypeId": 3,
"includeInPrintView": false,
"label": "NAATI Interpreter certification level",
"errorMessage": null,
"description": "Select level of certification for interpreting",
"value": "Certified Interpreter"
},
While this is a bit unconventional, I need to replace the “null” values by empty strings “”.
Any idea how to modify the request to achieve this? Otherwise, the null values mess up with the rest of my application.
Thank you