JSON
JSON(JavaScript Object Notation) 은 data 를 저장하고 교환하기 위한 경량의 텍스트 기반의 data format 이다. 본래 JavaScript 의 객체 표기법에서 파생되었지만, programming language 와 platform 에 독립적으로 사용할 수 있는 data format 이다.
주요 특징으로는 다음과 같다.
- 키-값 구조
- JSON 데이터는
key:value형태로 구성됨 - key 는 문자열이며, 항상 double-quotes(
"") 안에 있음 - value 는 숫자, 문자열(double-quotes), boolean, nested JSON object, array, null 가능
- JSON 데이터는
- 객체와 배열 지원:
- 객체(Object)는 중괄호
{}로 묶이며 여러 property 를 포함할 수 있음 - 배열(Array)은 대괄호
[]로 묶이며 순서가 있는 값의 집합을 표현
- 객체(Object)는 중괄호
Example
사용 예시는 다음과 같다.
{
"id": 12345, // Number
"name": "Alice", // String
"isActive": true, // Boolean
"profile": { // Nested JSON Object
"age": 30,
"city": "New York",
"skills": ["JavaScript", "Python", "SQL"]
},
"hobbies": ["reading", "traveling", null], // 배열(Array)
"partner": null // null 값
}