不废话,直接上代码: public class GsonUtils { public static Gson getMapGson(){ Gson gson=new GsonBuilder().registerTypeAdapter(Map.class, new JsonDeserializer<Map>() { public Map deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
在java中,把一个double或者BigDecimal的小数转换为字符串时,经常会用科学计数法表示,而我们一般不想使用科学计数法,可以通过:DecimalFormat a = new DecimalFormat("#,##0.00000000"); System.out.println(a.format(11111111.0000001000000001));的方式来格式化输出字符串. 对于BigDecimal的小数,如果制定精度<=6, 则可以放心的使用其toS