<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> JSON 测试 </title> <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"> </script> </head> <body> <script> //建立一个简单的Json对象 var testJsonObj = {"name":"lilao", "email":"xx@qq.com"}; alert("JSON OBJ:" + testJsonObj); //讲Json对象直接转换成字符串 var testJsonString = JSON.stringify(testJsonObj); alert("JSON String:"+ testJsonString); //将字符串转换成Json对象,使用了Jquery函数 alert(jQuery.parseJSON(testJsonString)); alert(jQuery.parseJSON(testJsonString).name); </script> </body> </html>