There is json
{ "message":{ "affenpinscher":[], "african":[], "bulldog":["boston","french"], ... "retriever":["chesapeake","curly","flatcoated","golden"] ... "wolfhound":["irish"] } } https://dog.ceo/api/breeds/list/all
I'm trying to deserialize this into the following structure >> Here is my deserializer:
public class BreedDeserializer implements JsonDeserializer<Map<String, List<String>>> { @Override public Map<String, List<String>> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { final JsonObject jsonObject = json.getAsJsonObject(); Type type = new TypeToken<Map<String, List<String>>>(){}.getType(); Map<String, List<String>> dogBreeds = context.deserialize(jsonObject.get("message"), type); return dogBreeds; } } Before calling the deserialize json-string method, I checked that there was an object "message" with an array of values. But in the end, the method returns null.