Не получается разобрать ответ JSON который получаю с сайта.
Мне нужно вывести из ответа все значения name
, делаю так:
private static final String TAG_RESPONSE = "response";
private static final String TAG_RESPONSE = "name";
JSONArray results = json.getJSONArray(TAG_RESPONSE ); // Массив из историй
for(int i = 0; i < results.length(); i++) // Перебор массива историй
{
JSONArray history = results.get(i).getJSONArray(TAG_STORY);
for(int j = 0; j < history.length(); j++) // Перебор истории
{
System.out.println("Статья:" + history.get(j));
}
}
В этом коде Eclipse ругается на строку:
JSONArray history = results.get(i).getJSONArray(TAG_STORY);
The method getJSONArray(String) is undefined for the type Object
Ответ с сервера:
{"id":"13","story":[{"name":"\u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b \u0417\u043e\u043b ","author":"1"}]},
{"id":"12","story":[{"name":"\u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 \u0412\u043e\u0443 ","author":"1"}]},
{"id":"10","story":[{"name":"\u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a \u041c\u0443\u0440\u043b\u044b\u043a ","author":"1"}]}
Что я делаю не так?