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
Add ScalarsConverterFactory to retrofit:
in gradle:
implementation'com.squareup.retrofit2:converter-scalars:2.5.0'
your retrofit:
retrofit = new Retrofit.Builder()
.baseUrl(WEB_DOMAIN_MAIN)
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
change your call interface @Body parameter to String, don't forget to add @Headers("Content-Type: application/json")
:
@Headers("Content-Type: application/json")
@POST("/api/getUsers")
Call> getUsers(@Body String rawJsonString);
now you can post raw json.