json操作 - 对象和json字符串 互转 JavaScript
?12345678910111213141516171819 | < 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 > |
https://www.cnblogs.com/eliwen/p/12045701.html 标签:info,log,JavaScript,字符串,json,互转 From: https://www.cnblogs.com/sunny3158/p/16785685.html