A Pen by richard park on CodePen.
Created
May 30, 2016 06:31
-
-
Save riix/09dfe2a3f8cf5cf4db29f3fc018396ef to your computer and use it in GitHub Desktop.
20.01 JSON 객체
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p> | |
| view console | |
| </p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var book = { | |
| child: [{ | |
| title: "Professional JavaScript", | |
| authors: [ | |
| "Nicholas C. Zakas" | |
| ], | |
| edition: 3, | |
| year: 2011 | |
| }, { | |
| title: "Professional JavaScript", | |
| authors: [ | |
| "Nicholas C. Zakas" | |
| ], | |
| edition: 3, | |
| year: 2011 | |
| }] | |
| }; | |
| var jsonText = JSON.stringify(book.child); // child 이하 문자열 직렬화 | |
| var _parse = JSON.parse(jsonText); // 파싱하여 네이티브 자바스크립트 값으로 바꿈 | |
| console.log(jsonText); | |
| console.log(_parse[0].title); // 첫번째 자식요소에서 title 값 추출 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { background-color: #333; } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment