Unfortunately this is not so simple. You need to create your own deserializer. I would recommend you to copy-paste the following classes from the source codes: ObjectTypeAdapter, MapTypeAdapterFactory and aux class TypeAdapterRuntimeTypeWrapper. Now fix MapTypeAdapterFactory.create method by replacing the following line:
TypeAdapter<?> valueAdapter = gson.getAdapter(TypeToken.get(keyAndValueTypes[1]));
with
TypeAdapter<?> valueAdapter = MyObjectTypeAdapter.FACTORY.create(gson, TypeToken.get(keyAndValueTypes[1]));
Now fix ObjectTypeAdapter.read method by replacing the following line:
case NUMBER:
return in.nextDouble();
with
case NUMBER:
return in.nextLong();
and the last thing: register your custom map serializer in gson:
Gson gson = new GsonBuilder()
.setPrettyPrinting()
.registerTypeAdapterFactory(new MyMapTypeAdapterFactory(new ConstructorConstructor(Collections.<Type, InstanceCreator<?>>emptyMap()), false))
.create();
Now any "NUMBER" data in JSON will be deserialized into long.