I have a String
String aString = "[{code:32022,estCode:0,timeZone:CE},{code:59400,estCode:0,timeZone:CE},{code:59377,estCode:0,timeZone:CE},{code:59525,estCode:0,timeZone:CE},{code:59560,estCode:0,timeZone:CE}]"
I am trying to convert this string to Map[]
using gson.
I tried using
Gson gsn = new GsonBuilder().create();
Map[] b = gsn.fromJson(aString , Map[].class);
I am able to parse it properly and I am getting output as
[{code=32022.0, estCode=0.0, timeZone=CE}, {code=59400.0, estCode=0.0, timeZone=CE}, {code=59377.0, estCode=0.0, timeZone=CE}, {code=59525.0, estCode=0.0, timeZone=CE}, {code=59560.0, estCode=0.0, timeZone=CE}]
but the values are converted to double i need it as String.
Ex: 32022 is converted to 32022.0 i need it as 32022 is there any way i can do it using ExclusionStrategy
in gson. I am seeing only two methos availalbe in ExclusionStrategy, shouldSkipClass and shouldSkipField
is there any other way to do it using gson.
Please help