JSON ๋?
JSON ๋ฌธ์ ํ์์ ์๋ฐ์คํฌ๋ฆฝํธ ๊ฐ์ฒด์ ํ์์ ๊ธฐ๋ฐ์ผ๋ก ๋ง๋ค์ด์ง
๋ฐ์ดํฐ ์ ์ก ์ ๋ง์ด ์ฌ์ฉํ๋ค.
๋คํธ์ํฌ๋ฅผ ํตํด ๋ฐ์ดํฐ๋ฅผ ์ฃผ๊ณ ๋ฐ๋๋ฐ ์์ฃผ ์ฌ์ฉ๋จ.
๊ตฌ์กฐ ๋ฐ ํน์ง
- ๋ฏธ๋์ดํ์ (Media type) => application/json
- ํ์ผ ํ์ฅ์ .json
- ์ค๊ดํธ๋ก ์์ / ๋ { }
- ์ด๋ฆ๊ณผ ๊ฐ์ ์์ผ๋ก ์ด๋ฃจ์ด์ง๋๋ค. => "์ด๋ฆ" : ๊ฐ
- ์ฌ๋ฌ๊ฐ์ผ๋ ์ผํ(,)๋ก ๊ตฌ๋ถํฉ๋๋ค.
์)


- ์๋ฐ์คํฌ๋ฆฝํธ ์์ // ์์ ํค ๊ฐ์ด ๋ฌธ์์ด์ด ์๋
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="shortcut icon" href="#" type="image/x-icon" />
<title>์ ์ด์จํ์</title>
</head>
<body>
<h1>์ ์ด์จ ๋ฐฐ์ฐ๊ธฐ</h1>
<script>
//์ ์ด์จ ํ์์ ์์ ํค ๊ฐ์ด ๋ฌธ์์ด์.
var cat = {
์ด๋ฆ: "๋งํธ๋ค",
ํ์ข
: "๋จผ์นํจ",
๋์ด: 3,
๋ฌด๊ฒ: 2.5,
};
</script>
</body>
</html>


JSON ๊ณผ Object ์ฐจ์ด
JSON ๋ฌธ๋ฒ ์ฒดํฌ ์ฌ์ดํธ
JSON Online Validator and Formatter - JSON Lint
Loading... About the JSONLint Editor JSONLint is a validator and reformatter for JSON, a lightweight data-interchange format. Copy and paste, directly type, or input a URL in the editor above and let JSONLint tidy and validate your messy JSON code. What Is
jsonlint.com
๋ณต์กํ JSON ํ์
https://mb21.github.io/JSONedit/
{
"์ฑ": "๊น",
"์ด๋ฆ": "ํญ์",
"๋์ด": 7,
"์ฃผ์": {
"Street": "๋ถ์ฐ๊ด์ญ์๋ถ์ ๋",
"Post": "12345"
},
"์ทจ๋ฏธ": [
"์ปคํผ",
"์ด๋",
"๊ณต๋ถ"
]
}

๋ค๋ฅธ ์์
์ํ api -> JSON ํ์
https://api.themoviedb.org/3/discover/movie?api_key=0fb9f2dfe831fa66b62e2f6609420903&language=ko&sort_by=popularity.desc&include_adult=false&include_video=false&page=1
'FRONTEND > ๊ธฐํ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| id๋ก DB๊ฒ์ํ์ฌ ๊ฒฐ๊ณผ ์ถ๋ ฅ (0) | 2023.10.04 |
|---|---|
| AJAX๋ก ๊ตฌ๊ตฌ๋จ ์ถ๋ ฅ (1) | 2023.10.04 |
| AJAX๋ฅผ ์ด์ฉํด ์๋ฒ์์ ๊ณ์ฐํ์ฌ ๊ฒฐ๊ณผ ์ถ๋ ฅํ๊ธฐ (0) | 2023.10.04 |
| ์์ ์ฝ๋ ์ฌ์ดํธ (0) | 2023.09.26 |
| ๋ฌด๋ฃ ์์ด์ฝ ๋ฐ ๋ฌด๋ฃ ์ฌ์ง ๋ค์ด๋ก๋ ์ฌ์ดํธ (0) | 2023.09.26 |