A webpage is basically created with HTML (hypertext markup language).CSS is used to style the webpage based on the creator’s wish. A simple webpage can be created by the basic tags that are available in the html language. html starts with the tag <html> inside which head and body tags are available. mostly the head tag consists of the title of the webpage. body tag contains the contents if the webpage that is to be showcased in the user interface.
JSON data.
JSON stands for java script object notation. These details are written inside a curly brackets . The JSON data must contain a key and a value. for example:
var student = {“name” : “Arun” , “department” : “information technology”}
Here the JSON values have a key and a value. the key values are separated from the values by using colon. all the attributes inside the curly brackets must be in the string format. The JSON format of data should not be integrated with any of the function attributes.
let us now look into an example for displaying a simple JSON data in an webpage.
<html> <head> <title> JSON datas </title> </head> <body bgcolor="blue"> <script> var stu = {"Name" : "John" , "Age" : "19" , "dept" : "computer science" , "percent" : "80%"} document.write ("student name is" +stu.Name+ <br> "student age is" +stu.age+ <br> "Department is" +stu.dept+ <br> "overall percentage is" +stu.percent); </script> </body> </html>
In the above html program a simple student data is given in JSON format inside a html program in order to display it in a web page. the expected output will be, displaying all the JSON details in a webpage named “JSON Datas” like,
OUTPUT:
Student name is john
student age is 19
Department is computer science
overall percentage is 80%