liyuhaoo
豪赌大赢家
2016-03-27 13:30

Gson 转map long出现1.490341044E12 ,而int出现1.0

  • android
  • gson
  • map
 String json = "{'expiretime1':1490341044000,'expiretime2':18813140601,'cost':1}";
Gson gson = new Gson();
Map<String, Object> resultMap = gson.fromJson(json, new TypeToken<Map<String, Object>>() {}.getType());
System.out.println("result:" + resultMap);

运行结果:
result:{expiretime1=1.490341044E12, expiretime2=1.8813140601E10, cost=1.0}
期望结果:
result:{expiretime1=1490341044000, expiretime2=18813140601, cost=1}
怎么解决呢?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答