Creation of Array object in javascript using JSON


<html>
<head>
<title>Creation of array object in javascript using JSON</title>
<style>
body {text-align:center;}
table ,td {border:1px solid black;padding:5px;}
table {width:400px;}
</style>
<script language=”javascript” >
document.writeln(“<h2>JSON Array Object</h2>”);
var employees = {
         “accounts”:[{“Name”:”Mayur Dighe”, “Salary”:27000},
         {“Name”:”Nikita Bansode”, “Salary”:27000},
         {“Name”:”Aditya Chalke”, “Salary”:28000}],
         “sales”:[{“Name”:”Satyajit Deshmukh”, “Salary”:29000},
         {“Name”:”Sharvari Patil”, “Salary”:31000},
         {“Name”:”Saurabh D.”, “Salary”:32000}],
         “production”:[{“Name”:”Namarta Kamble”, “Salary”:30000},
         {“Name”:”Arshad Shaikh”, “Salary”:30000}]
}
document.write(“<h3>Accounts</h3>”);
document.write(“<table align=center>”);
for(i=0;  i<employees.accounts.length; i++){
     document.write(“<tr><td>”+employees.accounts[i].Name+”</td>”);
     document.write(“<td>”+employees.accounts[i].Salary+”</td></tr>”);
}
document.write(“</table>”);
document.write(“<h3>Sales</h3>”);
document.write(“<table align=center>”);
for(i=0;  i<employees.sales.length; i++){
     document.write(“<tr><td>”+employees.sales[i].Name+”</td>”);
     document.write(“<td>”+employees.sales[i].Salary+”</td></tr>”);
}
document.write(“</table>”);
document.write(“<h3>Production</h3>”);
document.write(“<table align=center>”);
for(i=0;  i<employees.production.length; i++){
     document.write(“<tr><td>”+employees.production[i].Name+”</td>”);
     document.write(“<td>”+employees.production[i].Salary+”</td></tr>”);
}
document.write(“</table>”);
</script>
</head>
</html>
Regards,
Mayur Dighe
http://ImmortalDotNet.blogspot.com
http://MayurDighe.wordpress.com