+ if (gson == null) {
+ gson = new GsonBuilder()
+ .registerTypeAdapter(Integer.class, new JsonDeserializer<Integer>() {
+ @Override
+ public Integer deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
+ try {
+ return json.getAsInt();
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+ }
+ })
+ .create();