Practical 9-JSON
Practical 9-JSON
1.Create a JSON object for employees which stores the details like
id,name,salary up of the two employees
{
"employee": [
{
"id":"01",
"name": "Tamanna",
"salary": "75000"
},
{
"id":"07",
"name": "Gurleen",
"salary": "65001"
}]
}
Output
2.Json with JS Example
<html>
<head>
<title>JSON example</title>
<script language="javascript" >
var object1 = { "language" : "Java", "author" : "herbert schildt" };
document.write("<h1>JSON with JavaScript example</h1>");
document.write("<br>");
document.write("<h3>Language = " + object1.language+"</h3>");
document.write("<h3>Author = " + object1.author+"</h3>");
var object2 = { "language" : "C++", "author" : "E-Balagurusamy" };
document.write("<br>");
document.write("<h3>Language = " + object2.language+"</h3>");
document.write("<h3>Author = " + object2.author+"</h3>");
document.write("<hr />");
document.write(object2.language + " programming language can be studied " +
"from book written by " + object2.author);
document.write("<hr />");
</script>
</head>
<body>
</body>
</html>
OUTPUT