JSON.parse与eval和能将一个字符串解析成一个JSON对象,但还是有挺大区别. 测试代码 var A = "{ a: 1 , b : 'hello' }"; var B = "{ 'a': 1 , 'b' : 'hello' }"; var C = "{'a':1,'b':'hello'}"; var D = '{"a":1,"b":"hello"}'; var E = '{…
(1)JSON.parse 函数 var json = '{"name":"GDT","age":23,"University":"GDUT"}'; var info = JSON.parse(json); //解析为JSON对象 document.write(info.name + ' is a student of ' + info.University + ' and he is ' + info.a…