protected JSONObject getJSONObject ( final String key , final JSONObject jsonObject ) { JSONObject json = null ; try { if ( hasKey ( key , jsonObject ) ) { json = jsonObject . getJSONObject ( key ) ; } } catch ( JSONException e ) { LOGGER . error ( "Could not get JSONObject from JSONObject for key: " + key , e ) ; } return json ; }
Check to make sure the JSONObject has the specified key and if so return the value as a JSONObject . If no key is found null is returned .