Need replacement for eval(string) -> array
I've got a string that comes from a cookie value. The format of this string (after some minor manipulation) looks like this:
Here's the same string reformatted just to make it easier to view the parts:
Essentially, this string represents several nested arrays. I have no way of knowing how many items will be in any of the arrays.
I need to convert this structure to actual arrays.
I could do this:
var myArray = eval(myString);
But this is a security risk. Someone could have modified the cookie so that the resulting string would execute some malicious function.
What's the best (safest) way to convert my string to an array?