json - How to pass string in 'Body' Parameter of Retrofit 2 in android -


@post("api/login") call<apiresponse> loginuser(@body string user); 

here string jsonstring i.e.

{"email":"test@gmail.com","password":"test"} 

couldnt figure out wrong in this. either string again converted json. please suggest..

this want request shown in picture.

enter image description here

convert data in object

public class credentials {     public string email;     public string password; } 

set data object

credentials logincredentials = new credentials(); logincredentials.email = "test@gmail.com"; logincredentials.password = "password"; 

call api

@post("api/login") call<apiresponse> loginuser(@body credentials credentials); 

Comments