List of usage examples for org.json JSONArray optInt
public int optInt(int index)
From source file:ru.rzn.myasoedov.vktest.dto.VKChat.java
@Override public VKChat parse(JSONObject source) { try {/*w ww . j a v a2 s . c o m*/ JSONObject message = source.getJSONObject("message"); int chatId = message.getInt("chat_id"); super.parse(message); id = chatId; preview = message.optString("body"); date = message.optLong("date"); photoUrl = message.optString("photo_50"); JSONArray users = message.optJSONArray("chat_active"); if (users != null) { this.users = new int[users.length()]; for (int i = 0; i < this.users.length; i++) { this.users[i] = users.optInt(i); } } } catch (JSONException e) { return null; } return this; }