title: How to Map another Serializable Class in onResponse of Retrofit2.?
body: <pre><code> Call&lt;LoginResponse&gt; call = apiService.register(email, mob);
   call.enqueue(new Callback&lt;LoginResponse&gt;() {
                  @Override
                  public void onResponse(Call&lt;LoginResponse&gt; call, Response&lt;LoginResponse&gt; response) {
  
                      if(response.code()==200){
                          Gson gson = new Gson();
                          LoginResponse phoneLoginResponse = response.body();
                          String sPhoneLoginRes = gson.toJson(phoneLoginResponse, LoginResponse.class);
                          Log.d(TAG, "JSON RESPONSE IS" + sPhoneLoginRes);
                     }else if(response.code()==401){
  
     //here i want to show below Response
                          Gson gson = new Gson();
                          ErrorResponse errorResponse = response.body();
                          String sPhoneLoginRes = gson.toJson(errorResponse.toString(), LoginResponse.class);
                          Log.d(TAG, "JSON RESPONSE IS" + sPhoneLoginRes);
                    }else if(response.code()==400){
                          Toast.makeText(SignUpActivity.this, "Somethign went Wrong", Toast.LENGTH_SHORT).show();
                      }
  
  
  
                  }
  
                  @Override
                  public void onFailure(Call&lt;LoginResponse&gt; call, Throwable t) {
  
                  }
              });
  </code></pre>
  
  <p>This is what my 401 Response,when i tried submitting the form agian ,i need to get the below Object ,so i make use of ErrorResponse Class.But Response i am getting is Null.Please help me out.</p>
  
  <pre><code>{
    "message": "string",
    "errors": [
      "string"
    ]
  }
  </code></pre>
  
  <p>I am using Retrofit2.0</p>