I have a json like this
{
"data": {
"category": {
"name_en": "Trend",
"style": "normal"
},
"items": [
{
"title_en": "The Garfield Movie",
"imdb_rank": 5.8,
"country": "US",
"company": " Columbia Pictures"
}
]
},
"type": "category"
}
And I want to get data value and then using items. This is my code
map = new Gson().fromJson(
new Gson().toJson((HashMap<String, Object>) map.get("data")),
new TypeToken<HashMap<String, Object>>() {}.getType()
);
But I got this error:
07-09 19:50:16.615 12794 12794 E AndroidRuntime: java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to java.util.HashMap
I'm beginner at this can anybody tell me how to do it with Gson ?
Get HashMap value into HashMap
map
? How did you populate it?