Ex No: 10 | CONVERT LIST TO JSON |
---|---|
Aim: | To write a JavaScript program to convert list to JSON object. |
Algorithm | |
Step1: Create a folder “Ex10” to place all the HTML files and Image files. | |
Step2: Create two HTML file “index.html” and “marksheet.html”. | |
Step3: Add JavaScript code to get marks for each subject and convert it into Key-Value pair list. | |
Step4: Using JSON.stringify() method convert the list into JSON object and send it to the “marksheet.html” page. | |
Step5: In marksheet.html using urlParams.get() method get the JSON object. | |
Step6: Parse the JSON object and create Table body and display the Mark Sheet. | |
Source Code | Try It |
index.html
home.html
|
|
Result: | Thus JavaScript Code is written to convert a list to JSON object and successfully implemented. |