In my current project i use GSON library in android, and i\'ve faced a problem of nested Maps deserializtion. This is how initial json looks like
{
\"5\":
This gson.fromJson(br, HashMap.class);
tells to Gson that you want to deserialize to a Map of unknown value type. You would be tempted to specifiy something like Map
, but you can not do this in Java so the solution is to use what they called TypeToken in Gson.
Map categoryMap = gson.fromJson(br, new TypeToken