P
petermichaux
Hi,
I am gambling my soul and playing with eval(). I think this is similar
to JSON.
This script
var s = "{asdf:\"value\"}";
var o = eval(s);
var str = [];
for(p in o){
str.push(p + ":" + o[p]);
}
document.write("{" + str.join(", ") + "}");
outputs
{0:v, 1:a, 2:l, 3:u, 4:e}
but I expected
{asdf:value}
What's am I doing wrong (besides using eval())?
Thanks,
Peter
I am gambling my soul and playing with eval(). I think this is similar
to JSON.
This script
var s = "{asdf:\"value\"}";
var o = eval(s);
var str = [];
for(p in o){
str.push(p + ":" + o[p]);
}
document.write("{" + str.join(", ") + "}");
outputs
{0:v, 1:a, 2:l, 3:u, 4:e}
but I expected
{asdf:value}
What's am I doing wrong (besides using eval())?
Thanks,
Peter