728x90
⚠️ 2021.01.16에 작성된 글입니다 ⚠️
JSON
객체의 정보를 String 형태로 구조화하여 저장하는 형식
JSON(JavaScript Object Notation)은 경량의 DATA-교환 형식이다.
JSON은 두개의 구조를 기본으로 두고 있다:
1. name/value 형태의 쌍으로 collection 타입
: 다양한 언어들에서, 이는 object, record, struct(구조체), dictionary, hash table, 키가 있는 list, 또는 연상배열로서 실현 되었다.
2. 값들의 순서화된 리스트
: 대부분의 언어들에서, 이는 array, vector, list, 또는 sequence로서 실현 되었다.
- JSON 홈페이지
{ } → 객체
[ ] → 배열
key : value → 속성
속성이 여러 개이면 ,로 구분
JSON은 객체의 정보를 String 형태로 구조화하여 저장하는 형식이기 때문에 자바 객체의 정보를 JSON 형태로 변환하면 SharedPreferences에 구조화된 정보를 저장할 수 있다.
GSON
JAVA의 객체를 JSON형식으로, 혹은 반대로 JSON형식의 데이터를 JAVA 객체로 변환해주는 Google의 오픈소스 자바 라이브러리
Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. Gson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of.
There are a few open-source projects that can convert Java objects to JSON. However, most of them require that you place Java annotations in your classes; something that you can not do if you do not have access to the source-code. Most also do not fully support the use of Java Generics. Gson considers both of these as very important design goals.
- Google GSON 소개
참고자료
Java - Json 과 Gson 이란? (tistory.com)
공부하며 정리한 글입니다. 내용에 대한 피드백은 언제나 환영입니다.
728x90
'IT용어' 카테고리의 다른 글
[IT용어] 리눅스, 유닉스, GNU (0) | 2022.10.24 |
---|---|
[IT용어] API, open API (0) | 2022.10.23 |
[IT용어] Parsing 파싱 (0) | 2022.10.23 |