Access Json object from property.property format - Javascript JSon

Javascript examples for JSon:JSon String

Description

Access Json object from property.property format

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from  w w  w  . j  a va2  s .c  om*/
var str = '{"channels": [
   {"name": "video1","image": "images/bodyguard.jpg"},
   {"name": "video2","image": "images/bodyguard.jpg"},
   {"name": "video3","image": "images/bodyguard.jpg"}]}';
   
var obj = JSON.parse(str);
console.log(obj.channels.length);
    }

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

Related Tutorials