window.onload = function(){
var obj = '{
"name" : "Raj",
"age" : 32,
"married" : false
}';
var val = eval('(' + obj + ')');
alert( "name : " + val.name + "\n" +
"age : " + val.age + "\n" +
"married : " + val.married );
}
在类似这样的代码中,我试图创建JSON字符串只是为了玩转。引发错误,但是如果我将所有的姓名,年龄,已婚者放在一行(第2行)中,则不会。有什么问题?