Sending JSON in POST request with Retrofit2

后端 未结 4 1499
既然无缘
既然无缘 2020-12-03 11:24

I\'m using Retrofit to integrate my Web services and I do not understand how to send a JSON object to the server using a POST request. I\'m currently stuck, here is my code:

4条回答
  •  醉话见心
    2020-12-03 12:12

    From Retrofit 2+ use POJO objects rather than a JSON Object for sending requests with @Body annotations. With JSON object being sent the request fields are set to their default value than what has been sent from the app on backend. This won't be the case with POJO objects.

提交回复
热议问题