title: How to send json object inside another json object using Retrofit in android?
body: <p>I want to send json object inside another json object in post api call with retrofit 2 in android</p>
  
  <p>I want to send data like this : </p>
  
  <pre><code>    {
          "firstName":"abc",
          "emailId":"abc@a.a",
          "userType":{
              "id":"1"
          },
          "floor":{
              "id":"2"
          }
      }
  </code></pre>
  
  <p>I have created 3 model classes like this : </p>
  
  <p>1) <strong>Employee :</strong> </p>
  
  <pre><code>public class Employee implements Serializable {
  
      @SerializedName("firstName")
      @Expose
      private String firstName;
  
      @SerializedName("emailId")
      @Expose
      private String emailId;
  
      @SerializedName("userType")
      @Expose
      private Type userType;
  
      @SerializedName("floor")
      @Expose
      private Floor floor;
  
      public Employee(String firstName, String emailId, Type userType, Floor floor) {
          this.firstName = firstName;
          this.emailId = emailId;
          this.userType = userType;
          this.floor = floor;
      }
  
      public Employee(String firstName, String emailId, Type userType) {
          this.firstName = firstName;
          this.emailId = emailId;
          this.userType = userType;
      }
  
      public String getFirstName() {
          return firstName;
      }
  
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      public String getEmailId() {
          return emailId;
      }
  
      public void setEmailId(String emailId) {
          this.emailId = emailId;
      }
  
      public Type getUserType() {
          return userType;
      }
  
      public void setUserType(Type userType) {
          this.userType = userType;
      }
  
      public Floor getFloor() {
          return floor;
      }
  
      public void setFloor(Floor floor) {
          this.floor = floor;
      }
  }
  </code></pre>
  
  <p>2) <strong>Type :</strong> </p>
  
  <pre><code>public class Type implements Serializable {
  
      @SerializedName("id")
      @Expose
      private Integer id;
      @SerializedName("userType")
      @Expose
      private String userType;
  
      public Type(Integer id) {
          this.id = id;
      }
  
      public Integer getId() {
          return id;
      }
  
      public void setId(Integer id) {
          this.id = id;
      }
  
      public String getUserType() {
          return userType;
      }
  
      public void setUserType(String userType) {
          this.userType = userType;
      }
  }
  </code></pre>
  
  <p>3) <strong>Floor :</strong> </p>
  
  <pre><code>public class Floor implements Serializable {
  
      @SerializedName("id")
      @Expose
      private String id;
  
      public Floor(String id) {
          this.id = id;
      }
  
      public String getId() {
          return id;
      }
  
      public void setId(String id) {
          this.id = id;
      }
  }
  </code></pre>
  
  <p>And I've created API service like this : </p>
  
  <pre><code>public interface GetDataService {
      @POST("employees")
      Call&lt;Employee&gt; registerUser(@Body Employee employee);
  }
  </code></pre>
  
  <p>But it gives me bad request error (Code 400), so how to solve it?</p>