본문 바로가기
etc/it term

JSON (+GSON) - JSON과 GSON

by 윈 Win 2021. 1. 16.
728x90

블로그 이사했습니다!

 

👇 블로그 이전 공지 👇

블로그 이전 안내 (tistory.com)

 

 

👇 새 블로그에서 글 보기 👇

[IT용어] JSON, GSON — Win Record (tistory.com)

 

[IT용어] JSON, GSON

⚠️ 2021.01.16에 작성된 글입니다 ⚠️ JSON 객체의 정보를 String 형태로 구조화하여 저장하는 형식 JSON(JavaScript Object Notation)은 경량의 DATA-교환 형식이다. JSON은 두개의 구조를 기본으로 두고 있다.

win-record.tistory.com

 

 


 

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 홈페이지

이미지 출처: goanywhere

{ } → 객체

[ ] → 배열

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 소개

 

 

 


참고자료

JSON

Java - Json 과 Gson 이란? (tistory.com)

google/gson

 

 

 

 

공부하며 정리한 글입니다. 내용에 대한 피드백은 언제나 환영입니다.

'etc > it term' 카테고리의 다른 글

리눅스, 유닉스, GNU  (0) 2021.02.07
API & open API  (0) 2021.01.27
Parsing 파싱  (0) 2021.01.16
CRUD  (0) 2021.01.06

댓글