code: public static JSONObject processResponse(HttpResponse<String> response) {
  
          if (response != null) {
  
              if (response.getStatus() == 200) {
  
                  try {
  
                      return new JSONObject(response.getBody());
                  } catch (JSONException e) {
  
                      System.err.println("The API didn't return a JSON response. The actual response was " + response.getBody());
                  }
              } else {
  
                  JSONObject jsonResponse = null;
  
                  try {
  
                      jsonResponse = new JSONObject(response.getBody());
                  } catch (JSONException e) {
                  }
  
                  if (jsonResponse != null) {
  
                      System.err.println("The API returned the following error: " + jsonResponse.getString("description"));
                  } else {
  
                      System.err.println("The API returned error code " + response.getStatus());
                  }
              }
          }
  
          return null;
      }
docs: This does some generic processing on HttpResponse objects returned by the Telegram Bot API
  
  @param response The HttpResponse object returned by Unirest from the Telegram Bot API call
  
  @return A JSONObject containing the processed response or null if something was wrong with the response