-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjson1.html
More file actions
40 lines (35 loc) · 996 Bytes
/
json1.html
File metadata and controls
40 lines (35 loc) · 996 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
34
35
36
37
38
39
40
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="author" content="Adolfo Barrientos">
<title>My First JSON! Yay!</title>
<script>
let companies = [
{
name:"Big Corporation",
numberofEmployees : 1000,
CEO: "Mary",
rating: 3.6
},
{
name:"Small Startup",
numberofEmployees : 10,
CEO: null,
rating: 4.3
}
]
/* console.log(companies)*/
const myObj = JSON.stringify(companies);
localStorage.setItem("testJSON",myObj);
/*console.log(myObj);*/
/*console.log(JSON.parse(companies)[0].CEO)*/
console.log(JSON.parse(myObj))
console.log(JSON.parse(myObj)[0])
console.log(JSON.parse(myObj)[0].rating)
</script>
</head>
<body>
</body>
</html>