forked from bethrobson/Head-First-JavaScript-Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSON.html
More file actions
25 lines (21 loc) · 468 Bytes
/
JSON.html
File metadata and controls
25 lines (21 loc) · 468 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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title> JSON </title>
<script>
var fidoString = '{ "name": "Fido", "breed": "Mixed", "weight": 38 }';
var fido = JSON.parse(fidoString);
console.log("We have made a dog out of a string! " + fido.name);
var fido2 = {
name: "Fido",
breed: "Mixed",
weight: 38
};
var fidoString = JSON.stringify(fido2);
console.log("We made a string from a dog! " + fidoString);
</script>
</head>
<body>
</body>
</html>