<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script type="text/javascript">
        var json= [{"name":"a"},{"name":"b"},{"name":"c"}];
        var str = '[{"name":"abacd"},{"name":"b"},{"name":"c"}]';
        var aToStr=JSON.stringify(json);
        var bToObj=JSON.parse(str);
        alert(typeof(aToStr));  //string
        alert(typeof (bToObj));//object 
        alert(bToObj[0]["name"]);
    </script>
</head>
<body>

</body>
</html>

 

相关文章:

  • 2021-12-31
  • 2022-02-22
  • 2022-12-23
  • 2021-07-25
  • 2022-02-07
  • 2021-11-21
  • 2022-12-23
  • 2021-04-12
猜你喜欢
  • 2021-08-21
  • 2022-02-07
  • 2021-12-11
  • 2022-02-09
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
相关资源
相似解决方案