You can send the parameter as hashmap or pojo, the parameters will be sent as a JSON object. as:
@POST("user/checkloc") Call<CheckLocation> checkLocation(@Body Location location);
Here the location is a pojo object like:
public class Location { String lat,lng; public Location(String lat, String lng) { this.lat = lat; this.lng = lng; } }
and it will send the parameters as a JSON object like:
D/OkHttp﹕ --> POST /api/index.php/user/checkloc HTTP/1.1 D/OkHttp﹕ {"lat":"28.4792293","lng":"77.043042"}
You can also send the parameter as a hashmap:
@POST("user/checkloc") Call<CheckLocation> checkLocation(@Body HashMap<String, String> hashMap);
source share