SyntaxError: Expected end of stream at char 6 (#0(eval); line 13)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2020 02:15 AM
Hi,
Since we have upgraded to Paris we are now experiencing an error within one of our run script activities when attempting to Parse a JSON string. please see the error below:
SyntaxError: Expected end of stream at char 6 (#0(eval); line 13)
And also please see the code:
var queryOutput = data.get(17);
var jsonStr = queryOutput.output;
gs.log("Output: " + jsonStr, "WF_TEST");
//User doesn't exist
if (jsonStr == "[[]]") {
activity.result = 'no';
} else {
var jsonStr2 = jsonStr.slice(2, -2);
var obj = JSON.parse(jsonStr2);
var dn = workflow.scratchpad.dn = obj.distinguishedname.toString();
var uac = obj.useraccountcontrol.toString();
var str1 = "CN=" + workflow.scratchpad.user_id + ",OU=Staff";
var str2 = "CN=" + workflow.scratchpad.user_id + ",OU=Agency,OU=Staff";
if (dn.indexOf(str1) != -1 || dn.indexOf(str2) != -1) {
activity.result = 'yes';
//User is in correct group
} else {
activity.result = 'no';
//User is not in correct group
}
var uacCheck = ['2', '514', '546', '66050', '66082'];
if (uacCheck.indexOf(uac) >= 0)
workflow.scratchpad.disabled = 'true';
else
workflow.scratchpad.disabled = 'false';
}
The error seems to be coming from var obj = JSON.parse(jsonStr2); however I can't figure out why this would suddenly change following an upgrade.
Any help would be appreciated.
Thanks,
Alistair
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2020 03:27 AM
Hi,
Add a log statement after you create jsonStr2 to see what the object looks like. Does it have a trailing space?