1 parent 665399f commit 2003f0eCopy full SHA for 2003f0e
1 file changed
src/main/java/com/ngcodex/PokeApiClass.java
@@ -15,7 +15,7 @@ public static void main(String[] args) {
15
try {
16
HttpResponse<String> listResponse = client.send(listRequest, HttpResponse.BodyHandlers.ofString());
17
Map<String, Object> listResponseMap = JsonClass.parseJsonObject(listResponse.body());
18
- if (listResponseMap.containsKey("results")) {
+
19
List<Map<String, Object>> pokemonList = (List<Map<String, Object>>) listResponseMap.get("results");
20
if (!pokemonList.isEmpty()) {
21
Map<String, Object> firstPokemon = pokemonList.get(0);
@@ -68,4 +68,4 @@ public static void main(String[] args) {
68
e.printStackTrace();
69
}
70
71
-}
+}
0 commit comments