Stack Overflow archive
0 score

Deserialize JSON object to String Android

score
0
question views
753
license
CC BY-SA 3.0

For something that simple I don't think adding Gson as a dependency is worth it.

Example:

java
JSONObject jObj = new JSONObject(theJsonYouPostedAbove);
boolean status = jObj.getBoolean("status");
JSONArray jArr = jObj.getJSONArray("student");
for (int i = 0; i < jArr.length(); i++) {
    JSONObject jo = jArr.getJSONObject(i);
    int id = jo.getInt("id");
    String name = jo.getString("name");
    ...
}

Originally posted on Stack Overflow. Public user contributions are licensed under Creative Commons Attribution-ShareAlike.