Convert Json String to Object - Javascript jQuery

Javascript examples for jQuery:Json

Description

Convert Json String to Object

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>JSON.parse</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/*from   w  ww  .  j  ava  2s.c  o  m*/
var str = '{"name": "bob", "height": 4, "weight": 145}';
var json = JSON.parse(str);
console.log(json);
    });

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials