'How to post JSON Object direct using Retrofit in android Kotlin (Using MVVM Pattern)
I am using retrofit for posting data to server as below
@POST("web_php/app_user_login")
suspend fun loginApi(@Body body: RequestBodies.LoginRequestBody): Response<LoginResponse>
data class LoginRequestBody(
val user_name: String,
val user_password: String
)
But I want to post JSON Object directly just like as below
data class CreateAuditRequestBody(
val auditJsonObject: JSONObject
)
@POST("web_php/create_first_audit")
suspend fun createAuditApi(@Body body: RequestBodies.CreateAuditRequestBody): Response<CreateAuditResponse>
But It gives an error. Kindly Help me. Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
