title: How to I check int field is null for gson? [Android]
body: <p>I want to serialize nulls for a specific field or class.
  I've also researched stackoverflow but couldn't see a result.</p>
  
  <pre><code> GsonBuilder gsonBuilder = new GsonBuilder();
   gsonBuilder.serializeNulls().create(); 
  </code></pre>
  
  <p>I used it but it did not work.
  My Json result is two type. Pojo crashes when it's like the first case.</p>
  
  <pre><code>"character": {
     "id": "",
     "name": "" 
  },
  "character": {
     "id": 10,
     "name": "İrem"
  }
  </code></pre>
  
  <p>My crash's log:</p>
  
  <pre><code> com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: empty String
          at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:228)
          at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:218)
          at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
          at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
          at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
          at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
          at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
          at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
  </code></pre>
  
  <p>My Pojo</p>
  
  <pre><code>  @SerializedName("name")
    private String name;
    @SerializedName(value = "id")
    private Integer id; // or private int id; Both are failing.
  </code></pre>