GSON拋出“預(yù)期的BEGIN_Object但是BEGIN_數(shù)組”?我正試圖解析像這樣的JSON字符串[
{
"updated_at":"2012-03-02 21:06:01",
"fetched_at":"2012-03-02 21:28:37.728840",
"description":null,
"language":null,
"title":"JOHN",
"url":"http://rus.JOHN.JOHN/rss.php",
"icon_url":null,
"logo_url":null,
"id":"4f4791da203d0c2d76000035",
"modified":"2012-03-02 23:28:58.840076"
},
{
"updated_at":"2012-03-02 14:07:44",
"fetched_at":"2012-03-02 21:28:37.033108",
"description":null,
"language":null,
"title":"PETER",
"url":"http://PETER.PETER.lv/rss.php",
"icon_url":null,
"logo_url":null,
"id":"4f476f61203d0c2d89000253",
"modified":"2012-03-02 23:28:57.928001"
}]變成一個(gè)對(duì)象列表。List<ChannelSearchEnum> lcs = (List<ChannelSearchEnum>) new Gson().fromJson( jstring , ChannelSearchEnum.class);我該怎么解決呢?
3 回答

胡說(shuō)叔叔
TA貢獻(xiàn)1804條經(jīng)驗(yàn) 獲得超8個(gè)贊
ChannelSearchEnum
List<ChannelSearchEnum>
.
Type collectionType = new TypeToken<List<ChannelSearchEnum>>(){}.getType();List<ChannelSearchEnum> lcs = (List<ChannelSearchEnum>) new Gson() .fromJson( jstring , collectionType);
添加回答
舉報(bào)
0/150
提交
取消