Here we going to see, how JavaScript uses json


var obj={"name":"raja","age":20};
alert(obj.name);

The obj is an object ,holds json collection. we can directly access name using dot(.) operator Full Code


<html>
<head>
	
<title>
	
	JSON example
</title>	


</head>
<body>



<script type="text/javascript">

        
	    var obj={"name":"raja","age":20};
            alert(obj.name);

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

Demo