Code example for JSONObject: Parsing JSON documents

Methods: getJSONObject

0
import org.json.JSONWriter; 
 
public class JSONUtilities { 
    static public JSONObject getObject(JSONObject obj, String key) {
        try { 
            return obj.getJSONObject(key);
        } catch (JSONException e) {
            return null; 
        } 
    } 
     
    static public String getString(JSONObject obj, String key, String def) {
        try { 
            return obj.getString(key);
        } catch (JSONException e) {
            return def;
        } 
    } 
     
    static public int getInt(JSONObject obj, String key, int def) {
        try {