Results 1 to 3 of 3
Feb 1, 2008, 12:34 #1
- Join Date
- Dec 2007
- 0 Post(s)
- 0 Thread(s)
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:
[ [ 'foo' , [ [0,1], [2,0], [3,1] ] ], [ 'bar' , [ [2,1], [4,0] ] ] ]
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?