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>
posted @ 2020-12-29 17:55  *!Walter!*  阅读(53)  评论(0编辑  收藏  举报