от сервера приходит такой json:
{
"command":"client_history_requests",
"client_requests":
[
{"client_id_request":"10", "client_request_year":"2016", "client_request_mounth":"06", "client_request_day":"07", "client_request_hour":"19", "client_request_minute":"12", "client_request_second":"42"},
{"client_id_request":"11", "client_request_year":"2016", "client_request_mounth":"06", "client_request_day":"07", "client_request_hour":"19", "client_request_minute":"35", "client_request_second":"49"},
{"client_id_request":"12", "client_request_year":"2016", "client_request_mounth":"06", "client_request_day":"07", "client_request_hour":"19", "client_request_minute":"37", "client_request_second":"53"},
{"client_id_request":"13", "client_request_year":"2016", "client_request_mounth":"06", "client_request_day":"07", "client_request_hour":"19", "client_request_minute":"40", "client_request_second":"00"},
]
}
т.е. client_requests содержит массив. В андроид я делаю так:
JSONObject jsonFromServer = new JSONObject(dataFromServer);
String command = jsonFromServer.getString("command");
if (command.equals(SERVER_COMMAND_CLIENT_HISTORY_REQUESTS)){
JSONArray arrayClentHistoryRequest = jsonFromServer.getJSONArray("client_requests");
JSONObject jsonArrayRequest= new JSONObject(arrayClentHistoryRequest.getString(1));
Toast.makeText(AddNewRequestActivity.this, jsonArrayRequest.getString("client_request_year"), Toast.LENGTH_LONG).show();
и мне в тоаст выдется 2016, т.е. значение client_request_year первого элемента. а как получить client_request_year из воторого третьего и т.д?