public static <T> T fromJson(final String inJson, Class<T> objClass) {
		try {
			boolean errorFound = false;
			// if API returned errors or warnings
			if (GsonErrors.class.isAssignableFrom(objClass)) {
				GsonErrors gsonErrors = gson.fromJson(inJson, GsonErrors.class);
				if (gsonErrors != null) {
					// print errors
					if (gsonErrors.getErrors() != null) {
						errorFound = true;
						Logging.error("The API returned the following error(s): ");
						for (String error : gsonErrors.getErrors()) {
							Logging.error(error);
						}
					}
					// print warnings
					if (gsonErrors.getWarnings() != null) {
						errorFound = true;
						Logging.warn("The API returned the following warning(s): ");
						for (String warning : gsonErrors.getWarnings()) {
							Logging.warn(warning);
						}
					}
					if (errorFound) return null;
				}
			}
			T resultObj = gson.fromJson(inJson, objClass);
			return resultObj;
		} catch (Exception e) {
			return null;
		}
	}