Skip to content

Instantly share code, notes, and snippets.

@riix
Created May 30, 2016 06:31
Show Gist options
  • Select an option

  • Save riix/09dfe2a3f8cf5cf4db29f3fc018396ef to your computer and use it in GitHub Desktop.

Select an option

Save riix/09dfe2a3f8cf5cf4db29f3fc018396ef to your computer and use it in GitHub Desktop.
20.01 JSON 객체
<p>
view console
</p>
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 값 추출
body { background-color: #333; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment