I've got a string that comes from a cookie value. The format of this string (after some minor manipulation) looks like this:

"[['foo',[[0,1],[2,0],[3,1]]],['bar',[[2,1],[4,0]]]]"

Here's the same string reformatted just to make it easier to view the parts:
Code:
[
    [
        'foo' , 
        [
            [0,1],
            [2,0],
            [3,1]
        ]
    ],
    [
        'bar' , 
        [
            [2,1],
            [4,0]
        ]
    ]
]
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?