Здравствуйте. Помогите пожалуйста достать "text" из response:
response: {
count: 1,
items: [{
id: 1,
from_id: 390779710,
owner_id: -131534869,
date: 1478433642,
marked_as_ads: 0,
post_type: 'post',
text: 'Абракадабра
Приём
Проба Пера!',
can_delete: 1,
post_source: {
type: 'vk'
},
comments: {
count: 0,
can_post: 1
},
likes: {
count: 0,
user_likes: 0,
can_like: 1,
can_publish: 0
},
reposts: {
count: 0,
user_reposted: 0
}
}]
}
Вот так я пытаюсь это сделать, но у меня срабатывает JSONException e.
JSONException: No value for items
Код:
@Override
public void onComplete(VKResponse response) {
//Do complete stuff
JSONObject responseObj = response.json;
try {
JSONArray ar = responseObj.getJSONArray("items");
JSONObject arJSONObject = ar.getJSONObject(0);
String text = arJSONObject.getString("text");
Toast.makeText(UserInterface.this, text, Toast.LENGTH_SHORT).show();
} catch (JSONException e) {
e.printStackTrace();
Log.d(TAG, e.toString());
}
responseObj.getJSONArray("items")
он, похоже пустой