Parsing JSON maps / dictionaries with Gson?

Viewed 11997

I need to parse a JSON Response that looks like:

{"key1": "value1", 
 "key2": "value2", 
 "key3": 
    {"childKey1": "childValue1", 
     "childKey2": "childValue2", 
     "childKey3": "childValue3" }
}

class Egg { 
    @SerializedName("key1")
    private String mKey1;

    @SerializedName("key2")
    private String mKey2;

    @SerializedName("key3")
    // ???
}

I'm reading through the Gson docs but cannot figure out how to properly deserialize a dictionary to a Map.

2 Answers
Related