code: @SuppressWarnings("unchecked")
    private static List<String> toList(Object object) {
      List<String> list = new ArrayList<String>();
  
      if (object == null || object == JSONObject.NULL) {
        return null;
      }
  
      if (object instanceof List) {
        return ((List<String>) object);
      } else if (object instanceof JSONArray) {
        for (int i = 0; i < ((JSONArray) object).length(); i++) {
          try {
            list.add(String.valueOf((((JSONArray) object).get(i))));
          } catch (JSONException ex) {
            //issue converting the list. return null
            return null;
          }
        }
      } else {
        list.add(object.toString());
      }
  
      return list;
    }
docs: Helper method to convert a various type object to {@link List}
  
  @param object - object to convert to {@link List}
  @return - {@link List} or <code>null</code> on error