달력

42024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

1. List로 받을 경우

ArrayList<Lecture> lectureList = new ArrayList<Lecture>();

Lecture tmpLecture;

Gson gson = new Gson();

Type type = new TypeToken<ArrayLecture>() {

}.getType();

ArrayLecture jonResultlecturelist = (ArrayLecture) gson

.fromJson(sHtml, type);

lectureList = jonResultlecturelist.getLectures();


2. 한 객체로 받을 경우

 2.1

Lecture tmpLecture;

FreemindGson myGson = new FreemindGson();

tmpLecture = (Lecture) myGson.fromJson(sHtml, "Lecture");

2.2

 위 List로 받을 경우에서 type를 한 객체로 하면 됨

'자바' 카테고리의 다른 글

Eclipse 배경색 background 복구 색 변경 default  (0) 2014.05.02
gwt may need recompiled  (0) 2013.02.13
자바 url 파일 받기  (0) 2012.08.22
Posted by dewlit
|