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