を解析し、私の文字列データである:使用Gsonは、私は、文字列を流れる解析するGsonを使用しますが、私はexeption.Hereを取得するには、次の文字列
[
{
"source": "Gank.io #145 (2015-12-24)",
"title": "view",
"url": "https://github.com/florent37/ViewAnimator"
},
{
"source": "Gank.io #42 (2015-07-23)",
"title": "android",
"url": "https://github.com/kevinzhow/NaughtyImageView"
},
{
"source": "Gank.io #28 (2015-07-02)",
"title": "iOS UIView",
"url": "http://www.devtalking.com/articles/uiview-spring-animation/"
}
]
私は、文字列の上に解析するために流れるのコードを使用します。
Gson gson = new Gson();
SearchResultData searchResultData = gson.fromJson(json,SearchResultData.class);
List<SearchResult> searchResults = searchResultData.getResults();
私の例外は次のとおりです。
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
javaコードを表示します。 –
ここに 'SearchResultData'を投稿してください。 – Ironman
'public class SearchResultData { プライベートリスト結果; 公開リスト getResults(){ 戻り値; } パブリックvoid setResults(List results){ this.results = results; } } ' –
CoXier