Javascript examples for JSon:JSon Parse
Parse Json string to Json object
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/* www.java 2s . co m*/ 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>