I want to post this kind of request in retrofit2 so if someone have idea about it then it would be great help of mine.
reqObject={"task":"singleUser","taskData":{"userID":"1"}}
I want to post this kind of request in retrofit2 so if someone have idea about it then it would be great help of mine.
reqObject={"task":"singleUser","taskData":{"userID":"1"}}
Yes, good Question It is some what not understandable for Beginner
.
So I combining some Answers for you.
make your Json -> model class (or POJO class)
- From GsonFormattor plugin
This plug-in convert your Json to Model class
- Pojo genrator
Go to this link , copy and paste Your Json and simply make your model class.
OK , we completed our first step
Set all value to your Model class what You want from getter() setter()
.
Retrofit having @Body
annotation that use in your case
@POST("/jayson")
FooResponse postJson(@Body MyGsonModelClass body);
Where MyGsonModelClass
is class we made from first step.