<script src="js/jquery-1.10.1.min.js"></script>
<script>
$(function(){
//javscript-object 转换为json对象
var dog = {name:"hi",dob:new Date(),legs:[1,2,3,4]};
var jsonStr = JSON.stringify(dog);
console.log(jsonStr);
//输出 {"name":"hi","dob":"2013-06-06T09:37:46.103Z","legs":[1,2,3,4]}
//JSON对象转换为javascript对象
var jsonS = '{"myKey":"myValue"}';
var data = jQuery.parseJSON(jsonS);
console.log(data.myKey);
//输出myValue
});
</script>