Relative Content

Tag Archive for gson

lost decimals when json deserialization use Gson

public class GsonTest { class A { Float v; } public static void main(String[] args) { Gson gson = new Gson(); String aStr = “{ v:2752293.58 }”; A a = gson.fromJson(aStr, A.class); System.out.println(a.v); } } the result will be: 2752293.5 not the expected value: 2752293.58 anyone have the same problem? gson 1

lost decimals when json deserialization use Gson

public class GsonTest { class A { Float v; } public static void main(String[] args) { Gson gson = new Gson(); String aStr = “{ v:2752293.58 }”; A a = gson.fromJson(aStr, A.class); System.out.println(a.v); } } the result will be: 2752293.5 not the expected value: 2752293.58 anyone have the same problem? gson 1