This question may have been asked before but no it was not definitively answered. How exactly does one post raw whole JSON inside the body of a Retrofit request?
See
If you don't want to create extra classes or use JSONObject
you can use a HashMap
.
Retrofit interface:
@POST("/rest/registration/register")
fun signUp(@Body params: HashMap): Call
Call:
val map = hashMapOf(
"username" to username,
"password" to password,
"firstName" to firstName,
"surname" to lastName
)
retrofit.create(TheApi::class.java)
.signUp(map)
.enqueue(callback)