I have a string representation of an array:
'["item1", "item2", "item3"]'
I'm trying to convert this back to an array.
Any pointers appreciated.
I have a string representation of an array:
'["item1", "item2", "item3"]'
I'm trying to convert this back to an array.
Any pointers appreciated.
Try JSON.parse:
ary = JSON.parse(s);
Most browsers support it natively, for others you'll need json.js
eval for this task and it will accept single quotes, but make sure you think it through first.