title: Retrofit 2, parsing json, ignore wrong data type inside array
body: <p>i'm trying to parse a response json from server. the data is an array of objects, but some times server send an boolean between items of array. like this:</p>
  
  <pre><code>{
      "msg_code": 200,
      "msg_type": "success",
      "msg_text": "success",
      "msg_data": [
          {
              "pid": "1234567",
              "time": "1459029423",
              "parent_pid": "0"
          },
          false,
          {
              "pid": "987654",
              "time": "1458997403",
              "parent_pid": "0"
          }
      ]
  }
  </code></pre>
  
  <p>as you can see there is a <strong>false</strong> between them. </p>
  
  <p>when i try to parse these the the converter reach the wrong data type and throw an exception like these:</p>
  
  <pre><code>com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BOOLEAN at line 1 column 9988 path $.msg_data[12]
  </code></pre>
  
  <p>so how can i skip this wrong datatype and continue to parse other elements?</p>
  
  <p>this is my code for creating Retrofit client:</p>
  
  <pre><code>HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
          logging.setLevel(logLevel);
  
          OkHttpClient okHttpClient = new OkHttpClient.Builder()
                  .addInterceptor(logging)
                  .connectTimeout(60, TimeUnit.SECONDS)
                  .writeTimeout(60, TimeUnit.SECONDS)
                  .readTimeout(60, TimeUnit.SECONDS)
                  .build();
  
          gooderApi = new Retrofit.Builder()
                  .baseUrl(BASE_API_URL)
                  .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                  .addConverterFactory(GsonConverterFactory.create())
                  .client(okHttpClient)
                  .build()
                  .create(ApiInterface.class);
  </code></pre>
  
  <p>i searched alot and i know i must create a custom converter factory, but all the example are old and belongs to Retrofit &lt; 2, and i don't know how to make them work for me.</p>
  
  <p><strong>Update:</strong>
  similar question:
  <a href="https://stackoverflow.com/questions/27212598/gson-ignore-elements-with-wrong-type">GSON ignore elements with wrong type</a></p>
  
  <p>tnx in advance.</p>