gson(3)
-
Android JSON using GSON 쉽게 변환
Android JSON using GSON 쉽게 변환 이런 식으로 만든다고 볼 때~ 여러 가지 방법들이 많다. 매번 할 때마다 헷갈려서 정리해봄 { "DATE":"20161024091429699155", "MUSIC_LIST":[ { "NAME":"가수이름", "TITLE":"노래제목" }, { "NAME":"가수이름", "TITLE":"노래제목" }, { "NAME":"가수이름", "TITLE":"노래제목" }, { "NAME":"가수이름", "TITLE":"노래제목" } ]}public class ModelMakeMusic { String DATE; List MUSIC_LIST; public ModelMakeSetPushType(String DATE, List MUSIC_LIST) { this.DAT..
2017.07.14 -
Android assets 파일에 JSON 넣기
Android assets 파일에 JSON 넣기 assets 파일안에 서버통신을 하기 귀찮고 빨리 확인하고 싶을때... 간단한 방법으로 확인가능 GSON으로 사용하면 더욱더 빠르겠조~? orhanobut.logger 는 정말 좋은 로거~ assets 폴더를 만들고 json형식 파일을 넣으시면 끝! package com.example.test.pricetest; import android.content.res.AssetManager; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import com.google.gson.Gson; import com.orhanobut.logger.LogLevel; import com.o..
2016.03.24 -
gson 사용법 + JSON 예제
gson 사용법 + JSON 예제 참고 : https://github.com/google/gson 예제1 이런 JSON 값이 있다고 가정합니다. { "resMsg": "suc", "result": { "rec": [ { "ADDR": "seoul addr1" }, { "ADDR": "seoul addr2" }, { "ADDR": "seoul addr3" }, { "ADDR": "seoul addr4" } ] } } Gson gson = new Gson(); JsonParser parser = new JsonParser(); JsonElement rootObejct = parser.parse(json값) .getAsJsonObject().get("result") .getAsJsonObject().get("..
2015.12.22