-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtut62.html
More file actions
33 lines (28 loc) · 795 Bytes
/
Copy pathtut62.html
File metadata and controls
33 lines (28 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JSON Tutorial</title>
</head>
<body>
<div class="container">This is my containter</div>
<script>
let jsonObj = {
name: "chinmay",
channel: "d1vine",
friend: "Aman",
food: "chinese"
}
console.log(jsonObj);
//stringify a JSON object
let myJsonStr = JSON.stringify(jsonObj);
console.log(myJsonStr);
myJsonStr = myJsonStr.replace("chinmay", "Chinu");
console.log(myJsonStr);
// agian change it into object
newJsonObj = JSON.parse(myJsonStr);
console.log(newJsonObj);
</script>
</body>
</html>