Hyper Text Transfer Protocol
JavaScript Object Notation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<h2>JSON코드 JS코드로 바꾸기</h2>
<script>
const json = `{
"name" : "nathan29849",
"age" : "99",
"friends" : {"#":2,
"classmate": "YANG",
"neighborhood": "Lee"},
"residence" : "Hwaseong-si",
"hobby" : ["Playing the piano", "Drawing picture"]
}`;
const obj = JSON.parse(json);
document.write(obj.name + "<br>");
document.write(obj.age + "<br>");
document.write(obj.friends + "<br>");
document.write(obj.friends.classmate + "<br>");
document.write(obj.residence + "<br>");
document.write(obj.hobby + "<br>");
</script>
</body>
</html>