R
radykl
Can anyone explain me why you need to add open and close parenthesis to
a JSON text in order to use eval() to parse it?
For example:
var json = "{a: 'abc', b: 'def'}";
var obj1 = eval("(" + json + ")"); //ok!
var obj2 = eval(json); //syntax error!
why are parenthesis necessary?
Thanks!
/Andres.
a JSON text in order to use eval() to parse it?
For example:
var json = "{a: 'abc', b: 'def'}";
var obj1 = eval("(" + json + ")"); //ok!
var obj2 = eval(json); //syntax error!
why are parenthesis necessary?
Thanks!
/Andres.