<!DOCTYPE html>
<html>
<head>
<title>Simple JSON Example</title>
</head>
<body>
<h2>JSON Example</h2>
<script>
// Create a simple JSON object
let student = {
"name": "Manasi",
"age": 17
};
// Display on console
console.log(student);
// Display on web page
document.write("Name: " + student.name + "<br>");
document.write("Age: " + student.age);
</script>
</body>
</html>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter