71 String responseStr = this.getResponse();
72 if (responseStr ==
null || responseStr.trim().isEmpty()) {
73 throw new IllegalArgumentException(
"Response is empty or null");
78 if ((!responseStr.trim().startsWith(
"{") && !responseStr.trim().startsWith(
"[")) ||
79 (!responseStr.trim().endsWith(
"}") && !responseStr.trim().endsWith(
"]"))) {
80 throw new IllegalArgumentException(
"Response is not a valid JSON object");
83 Map<String, Object> response = getObjectMapper().readValue(responseStr,
84 new TypeReference<Map<String, Object>>() {
87 }
catch (JsonProcessingException e) {
88 throw new IllegalArgumentException(
"Failed to parse response as JSON: " + e.getMessage(), e);