<script> // json 数据转换 var data = { name: '小明', age:200, fav:["code","eat","swim","read"], son:{ name:"小小明", age:100, } }; // console.log( data ); // 把对象转换成 json 字符串 var info = JSON.stringify(data); console.log(info) // 把 json 字符串转换成对象 var data2 = JSON.parse(info); console.log(data2) </script>