I have a string representation of an array:
\'[\"item1\", \"item2\", \"item3\"]\'
I\'m trying to convert this back to an array.
Any
You also can Use
var genericList = eval('(' + s + ')');
for(i=0;i<genericList.lengthl;i++){
alert("element : " + genericList[i]);
}
Just use JSON.parse('["item1", "item2", "item3"]');
Try JSON.parse:
ary = JSON.parse(s);
Most browsers support it natively, for others you'll need json.js