title: Custom converter for Retrofit 2
body: <p>I have to handle a dynamic JSON responses.</p>
  
  <p>Before, I was using classes and annotations as follows:</p>
  
  <pre><code>public class ChatResponse {
  
      @SerializedName("status")
      private int status;
  
      @SerializedName("error")
      private String error;
  
      @SerializedName("response")
      private Talk response;
  
      public int getStatus() {
          return status;
      }
  
      public String getError() {
          return error;
      }
  
      public Talk getResponse() {
          return response;
      }
  }
  </code></pre>
  
  <p>When the status is 1 (success) the <code>onResponse</code> is fired and I can get a ChatResponse object. But, when the status is 0, the response is false in the JSON representation and it fails (<code>onFailure</code> is fired).</p>
  
  <p>I want to create my custom converter, and <a href="https://stackoverflow.com/questions/24279245/how-to-handle-dynamic-json-in-retrofit">this question</a> has a good example, but that example is for Retrofit 1.</p>
  
  <p><a href="http://square.github.io/retrofit/" rel="noreferrer">I have to</a> create a class that extends <code>Converter.Factory</code>, but I don't know how to override the methods of this class.</p>
  
  <p>Actually I have the next:</p>
  
  <pre><code>@Override
  public Converter&lt;ResponseBody, ?&gt; fromResponseBody(Type type, Annotation[] annotations) {
  
      return super.fromResponseBody(type, annotations);
  }
  
  @Override
  public Converter&lt;?, RequestBody&gt; toRequestBody(Type type, Annotation[] annotations) {
  
      return super.toRequestBody(type, annotations);
  }
  </code></pre>
  
  <p>How I can parse the JSON response by my own at this point?</p>
  
  <p>Thanks in advance.</p>