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
I particularly like Jake's suggestion of the TypedString
subclass above. You could indeed create a variety of subclasses based on the sorts of POST data you plan to push up, each with its own custom set of consistent tweaks.
You also have the option of adding a header annotation to your JSON POST methods in your Retrofit API…
@Headers( "Content-Type: application/json" )
@POST("/json/foo/bar/")
Response fubar( @Body TypedString sJsonBody ) ;
…but using a subclass is more obviously self-documenting.
@POST("/json/foo/bar")
Response fubar( @Body TypedJsonString jsonBody ) ;