public static String getString ( JSONObject json , String key , String defaultValue ) { if ( json . containsKey ( key ) ) { return json . getString ( key ) ; } else { return defaultValue ; } }
Returns the value of a JSON property as a String if it exists otherwise returns the defaultValue .