title: Caused by: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of com.model.user out of START_ARRAY token
body: <p>I am passing json string from restclient to resteasy webservice for model object user.</p>
  
  <p>I have set Content-Type=application/json</p>
  
  <p>and my json string in body is as follows,</p>
  
  <pre><code>{
      "id": "100",
      "email": "email",
      "add": [
          {
              "lastName": "lastName",
              "firstName": "firstName"
          },
          {
              "firstName": "firstName",
              "lastName": "lastName"
          }
      ]
  }
  </code></pre>
  
  <p>If i remove add array object as below, then i am getting the response as expected.</p>
  
  <pre><code>{
      "id": "100",
      "email": "email",
  }
  </code></pre>
  
  <p>When i try to send add array , server is throwing an exception saying,</p>
  
  <pre><code>Caused by: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of com.model.add out of START_ARRAY token
  </code></pre>
  
  <p>I tried this way also, but its not working,</p>
  
  <pre><code>{
      "id": "100",
      "email": "email",
       "lastName": "Something Four",
       "firstName": "Something Five"
  }
  </code></pre>
  
  <p>Then it is giving below error,</p>
  
  <pre><code>Caused by: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "lastName" (Class com.model.user), not marked as ignorable
  </code></pre>
  
  <p>My model objects are below,</p>
  
  <pre><code>public class user implements Serializable {
      @Id
      @Column(name="Id", unique=true, nullable=false)
      private int id;
  
      @Column(name="email", nullable=true, length=60)
      private String email;
  
      @ManyToOne(cascade=CascadeType.ALL, fetch = FetchType.EAGER)
      @JoinColumn(name="Id", nullable=false)
      private add add;
  }
  
  
  
  public class add implements Serializable {
  
      @Id
      @Column(name="Id", unique=true, nullable=false)
      private String id;
  
      @Column(name="LastName", nullable=true, length=128)
      private String lastName;
  
      @Column(name="FirstName", nullable=true, length=128)
      private String firstName;
  
  }
  </code></pre>
  
  <p>My service class</p>
  
  <pre><code>@POST
      @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
       public Response addAccount(@FormParam("id") String id,
               @FormParam("lastName") String lastName,
               @FormParam("firstName") String firstName,
               @FormParam("email") String email{
  
  
  
              user.setId(id); 
              add.setLastName(lastName);
              add.setFirstName(firstName);
              user.setEmailAddress(email);
  }
  </code></pre>
  
  <p>Can anyone help me in passing one model object inside other model object as an array in json string?</p>