I am trying to form an array from a string using Modified Java Script Value step. Here is my code to parse a string and to form a JSON object.
var info = {};
var keywords = 'Adjust course (C-6),Identify underlying factors (C-4),Isolate teacher actions (C-3_)';
if(keywords != null && keywords != ''){
keywords = keywords.replace(/,/g,'","');
keywords = '["'+keywords+'"]';
info.keywords = JSON.parse(keywords);
}
Here in JSON.parse() it throws an error SyntaxError: Missing comma in array literal.
Can anyone please help me parse the array and store in json object.
Thanks in advance!
eval
function, but be careful! – Ruthiconsole.log(keywords)
before parsing in your environment and tell what is it? – Tades