title: Android - How to use POST method withi @Body in retrofit 2?
body: <p>I'm trying to insert user into MySQL database from my Android app using method post RetrofitAPI. But i got this error: <strong>java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $</strong>. Here is my code:
  File GetAPI:</p>
  
  <pre><code>public interface GetApi {
  @POST("addmember.php")
  Call&lt;ModelInsertUser&gt; insertUser(
          @Body ModelInsertUser modelLogin
  );}
  </code></pre>
  
  <p>File ModelInsertUser:</p>
  
  <pre><code>public class ModelInsertUser implements Serializable {
  
  private String ten_tv;
  private String mk_tv;
  
  public ModelInsertUser(String ten_tv, String mk_tv) {
      this.ten_tv = ten_tv;
      this.mk_tv = mk_tv;
  }
  
  public String getTen_tv() {
      return ten_tv;
  }
  
  public String getMk_tv() {
      return mk_tv;
  }
  
  public void setTen_tv(String ten_tv) {
      this.ten_tv = ten_tv;
  }
  
  public void setMk_tv(String mk_tv) {
      this.mk_tv = mk_tv;
  }}
  </code></pre>
  
  <p>And my MainActivity(just have addMember method): </p>
  
  <pre><code>private void addMember() {
      ModelInsertUser model = new ModelInsertUser(edtUser.getText().toString(),edtPass.getText().toString());
      Gson gson = new GsonBuilder()
              .setLenient().create();
      Retrofit retrofit = new Retrofit.Builder().baseUrl("http://192.168.1.130/database/")
              .addConverterFactory(GsonConverterFactory.create(gson))
              .build();
      GetApi service = retrofit.create(GetApi.class);
      Call&lt;ModelInsertUser&gt; call = service.insertUser(model);
      call.enqueue(new Callback&lt;ModelInsertUser&gt;() {
          @Override
          public void onResponse(Call&lt;ModelInsertUser&gt; call, Response&lt;ModelInsertUser&gt; response) {
              Log.d("DEMOO","hello");
          }
  
          @Override
          public void onFailure(Call&lt;ModelInsertUser&gt; call, Throwable t) {
              Log.d("DEMOO",t.getMessage());
          }
      });
  }
  </code></pre>
  
  <p>I know this error because i need a JSON object but i have String, but i don't
  know where is this error. 
  Thanks for your help!</p>