메신저 다음 JSON 파일을 읽으려고 : 내가 가정 있도록 "항목"개체에 무엇이 아는IllegalStateException이 GSON
public class RSSWrapper{
public RSS rss;
public class RSS{
public Channel channel;
}
public class Channel{
public List<Item> item;
}
public class Item{
String description;//Main Content
String dc_identifier;//Link
String pubDate;
String title;
}
}
임에만 관심이 객체에
{ "rss" : {
"@attributes" : {"version" : "2.0" },
"channel" : {
"description" : "Channel Description",
"image" : {
"link" : "imglink",
"title" : "imgtitle",
"url" : "imgurl"
},
"item" : {
"dc_format" : "text",
"dc_identifier" : "link",
"dc_language" : "en-gb",
"description" : "Description Here",
"guid" : "link2",
"link" : "link3",
"pubDate" : "today",
"title" : "Title Here"
},
"link" : "channel link",
"title" : "channel title"
}
}
}
을
Gson gson = new Gson();
RSSWrapper wrapper = gson.fromJson(JSON_STRING, RSSWrapper.class);
를하지만, 메신저 오류가 점점 : 호출 할 때 위의 클래스는 일하는 것이
나는 이것이 의미하는 바를 알지 못하므로 어디서 오류를 찾을 지 모르겠다. GSON에 대한 더 나은 지식을 가진 누군가 나를 도울 수 있을까?
감사합니다 :)
대개 두 개 이상의 항목이 있습니다.이 경우에는 하나만 있습니다. – Edd
@clairharrison 제 대답의 두 번째 부분을 봅니다. – Katona