title: Android GSON deserialize delete empty arrays
body: <p>I'm using GSON with Retrofit. I want to disable empty array field deserialization.</p>
  
  <p>DTO:</p>
  
  <pre><code>public class Entity implements Serializable {
  
      @SerializedName("body")
      @Expose
      private BodyObject body;
  </code></pre>
  
  <p>I work with a <code>rest API</code>. If the body field is empty then it send empty <code>Array</code>:</p>
  
  <pre><code>{
  "body": []
  }
  </code></pre>
  
  <p><strong>Exception:</strong> </p>
  
  <pre><code>java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 443 path $.body
  </code></pre>
  
  <p>If the body is filled, then they send the correct Object.</p>
  
  <pre><code>{
    "body":  {
      "und": [
          {
          "value": "Test ....",
          "summary": "",
          "format": "filtered_html",
          "safe_value": "&lt;p&gt;Test ....&lt;/p&gt;\n",
          "safe_summary": ""
          }
      ]
    }
  }
  </code></pre>
  
  <p>-</p>
  
  <pre><code>Gson gson = new GsonBuilder()
                  .setLenient()
                  .create();
  </code></pre>
  
  <p>How can I delete, or disable these empty arrays deserializations?</p>