02 json.parse
作者:互联网
<!DOCTYPE html>
<html lang="en">
<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head>
<body> <div></div> <script type="text/javascript"> var str = '{ "name": "baba", "age": 12, "info": { "locate": "浙江" } }';
var user = JSON.parse(str);
console.log(user); // 输出一个 JavaScript 对象
</script> </body>
</html>
<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head>
<body> <div></div> <script type="text/javascript"> var str = '{ "name": "baba", "age": 12, "info": { "locate": "浙江" } }';
var user = JSON.parse(str);
console.log(user); // 输出一个 JavaScript 对象
</script> </body>
</html>
标签:02,baba,parse,json,user,str,var 来源: https://www.cnblogs.com/wuhui1222/p/14207989.html