For Gson, you get the following conversions:
Map<String, Double> -> {"one": 123, "two":123.45} Map<String, Number> -> {"one": 123, "two":123.45} Map<String, String> -> {"one": "123", "two": "123.45"}
Basically, there is no way to get Gson to automatically convert your strings to numeric values. If you want them to appear as numeric (i.e., without quotes), you need to save the corresponding data type on the map, Double or Number .
In addition, Json has only a limited number of primitive types; it stores a string or a number. The numerical value does not distinguish between Integer , Long , Double , etc., Therefore, I am not sure why you are trying to distinguish them. Once it is saved as Json, they will all be considered the same numeric type.
bcorso
source share