diff --git a/scripts/api_client.gd b/scripts/api_client.gd index 793cc63..2f54bf7 100644 --- a/scripts/api_client.gd +++ b/scripts/api_client.gd @@ -172,16 +172,17 @@ func _on_http_request_completed( var detail: String = "" if response_code >= 200 and response_code < 300: - # Success — try to parse JSON. + # Success — try to parse JSON (works for both objects and arrays). var parse_result = JSON.parse_string(json_string) - if parse_result is Dictionary: + if parse_result is Dictionary or parse_result is Array: data = parse_result - # Extract backend detail if present. - if data.has("detail"): + # Extract backend detail if present (e.g. {"ok": true, "detail": "OK"}). + if data is Dictionary and data.has("detail"): detail = str(data["detail"]) else: detail = "OK" else: + # Not valid JSON — return raw string. data = json_string detail = "OK" else: