stringResponseが
が含まれている必要があり
@Override
protected Response doInBackground(String... objects) {
try {
String stringResponse = loadJSON(objects[0]);
Gson gson = new Gson();
return gson.fromJson(stringResponse, Response.class);
}catch (IOException e) {
e.printStackTrace();
return null;
} catch (JsonSyntaxException e) {
e.printStackTrace();
return null;
}
}
が、これは私のJSONです
{"Code":"ascascasd",
"SKU":"asd",
"Name":"asd",
"Description":"d",
...
...
}
なく
[{"Code":"ascascasd",
"SKU":"asd",
"Name":"asd",
"Description":"d",
...
...
}]
または「応答」オブジェクトのリストが含まれている別のクラスを追加し、gson.fromJson()
に新しいクラスを渡します