title: How to get Retrofit callback get response body in Json formate
body: <p>I'm using Retrofit for integrating web services and when run my app controller going to Retrofit success block but how can i print ResponseBody in Json string formate </p>
  
  <p>can some one help me please</p>
  
  <h2>   Main Activity:-</h2>
  
  <pre><code>  import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  import java.util.concurrent.TimeUnit;
  import okhttp3.OkHttpClient;
  import okhttp3.logging.HttpLoggingInterceptor;
  import retrofit2.Retrofit;
  import retrofit2.converter.gson.GsonConverterFactory;
  
          @Override
              protected void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setContentView(R.layout.activity_main);
  
                  Retrofit retrofit = new Retrofit.Builder().baseUrl(url).
                          addConverterFactory(GsonConverterFactory.create()).build();
  
                  RetrofitGetAPI service = retrofit.create(RetrofitGetAPI.class);
  
                  retrofit.Call&lt;List&lt;CardTypes&gt;&gt; call = service.getProfileData();
  
                  call.enqueue(new Callback&lt;List&lt;CardTypes&gt;&gt;() {
                      @Override
                      public void onResponse(Response&lt;List&lt;CardTypes&gt;&gt; response, Retrofit retrofit) {
                          System.out.println("Response is=====&gt;" + response.body());
                      }
  
                      @Override
                      public void onFailure(Throwable t) {
                          System.out.println("Failure response is====&gt;");
                      }
                  });
              }
  </code></pre>
  
  <p>RetrofitGetAPI:-
      ------------</p>
  
  <pre><code>  public interface RetrofitGetAPI {
  
      @GET("api/RetrofitProfileResponse")
      Call&lt;List&lt;CardTypes&gt;&gt; getProfileData();
  }
  </code></pre>
  
  <h2>CardTypes:-</h2>
  
  <pre><code>public class CardTypes {
  
      private int paymenttypeid;
      private String cardType;
  
      public String getCardType() {
          return cardType;
      }
  
      public void setCardType(String cardType) {
          this.cardType = cardType;
      }
  
      public int getPaymenttypeid() {
          return paymenttypeid;
      }
  
      public void setPaymenttypeid(int paymenttypeid) {
          this.paymenttypeid = paymenttypeid;
      }
  
  }
  </code></pre>
  
  <h2>Server response:-</h2>
  
  <pre><code>   [
    {
      "paymenttypeid": 1,
      "cardType": "Master Card"
    },
    {
      "paymenttypeid": 2,
      "cardType": "VISA"
    }
  ]
  </code></pre>