I’m having issues when receiving data from JotForm. When I build it in test, the data for a field comes in as JSON. I have JS that processes that JSON, but when it actually runs, the data is parsed out as an array. Any suggestions?
The Zap is: Jotform → JS → Loop from Line Items
Test (Jotform):
Jotform (Live):
JS Step:
var input_examinee_json = inputData.answers_field_examinee_list;
var valid_json = false;
var array_examinees = r];
var formatted_email_address = null;
var formatted_email_domain = null;
// get e-mail domain of requestor
formatted_email_address = inputData.input_email_address.toLowerCase();
formatted_email_domain = inputData.input_email_address.split('@').pop();
formatted_email_domain = formatted_email_domain.toLowerCase();
if(isJsonString(input_examinee_json)) {
var parsed_examinees = JSON.parse(input_examinee_json);
for(var i = 0; i < parsed_examinees.length; i++) {
array_examinees i] = parsed_examineespi];
}
}
output = >
{
array_examinees: array_examinees,
requestor_formatted_email_address: formatted_email_address,
requestor_formatted_email_domain: formatted_email_domain
}
];
function isJsonString(str) {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
}
JS Step Test:
The loop in test:
The error in Loop (Live):