It's not a good aproach to mix types like this (integers with doubles). Since you are using Object as a type, you won't be able to get both Integers and Doubles from the map. Gson decides which type is more apropriate for Object. In your case it is Double, because all values CAN BE doubles, but all values CAN'T BE integers.
If you really need to mix types, try to use Number class instead of Object. Example:
public static void main(String[] args){
String array = "[1, 2.5, 4, 5.66]";
Gson gson = new Gson();
Type type = new TypeToken<ArrayList<Number>>() {}.getType();
List<Number> obj = gson.fromJson(array, type);
System.out.println(Arrays.toString(obj.toArray()));
}
Output: [1, 2.5, 4, 5.66]
While this:
public static void main(String[] args){
String array = "[1, 2.5, 4, 5.66]";
Gson gson = new Gson();
Type type = new TypeToken<ArrayList<Object>>() {}.getType();
List<Object> obj = gson.fromJson(array, type);
System.out.println(Arrays.toString(obj.toArray()));
}
will give you output: [1.0, 2.5, 4.0, 5.66]