<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> </body> <script type="text/javascript"> var str='{"name":"小明","age":"23"}'; var aa=JSON.stringify(str); //.stringify()用于从一个对象解析出字符串 var bb=JSON.parse(str);//parse() 用于从一个字符串中解析出json 对象 console.log(bb); console.log(aa); </script> </html>
转载请注明原文地址: https://www.6miu.com/read-10411.html