I've got this string which needs to be converted to an array:
var string = "[[Restaurants], [Restaurants], [Restaurants], [Caterers, Foods - Take-out]]";
I then need to be able to access its value like so:
var foo = arr[0]; //returns "Restaurant"
var bar = arr[3]; //returns "Caterers, Foods - Take-out"
I tried removing the first and last characters ( "[" and "]" ) but I was still left with a problem when splitting on "," because some of the value have commas inside them. Any ideas?