i want to pass POST parameter whose type is json in retrofit2 like given below !!
{"person":{"phone":99999,"first_name":"fl","last_name":"asdad","email":"gb@fa.com",
"home_address":{"country_code":"in","zip":123456}}}
how do may i pass it.?
for example
@Headers({"Accept:application/json", "Content-Type:application/json;"})
@POST(WS.profile_new_user)
Call<ProfilePOJO> peopleRegister(@QueryMap Map<String, String> objectMap);
Call<ProfilePOJO> call = Api_Handler.getApiService().peopleRegister(getJsonString());
call.enqueue(new Callback<ProfilePOJO>() {
@Override
public void onResponse(Call<ProfilePOJO> call, Response<ProfilePOJO> response) {
if (response.isSuccessful()) {
Toast.makeText(context, "done", Toast.LENGTH_SHORT).show();
} else
Toast.makeText(context, "error", Toast.LENGTH_SHORT).show();
Log.e("response", new Gson().toJson(response.body()));
}
@Override
public void onFailure(Call<ProfilePOJO> call, Throwable t) {
}
});
public String getJsonString() {
Map<String, String> map = new HashMap();
map.add("",""); //i stuck @ here.i don't know how to pass json type as a parameter here.
return map;
}
as a parameter my type is json whose value is above json String. Thank you in advance.