How to handle Dynamic JSON in Retrofit?

后端 未结 10 2343
余生分开走
余生分开走 2020-11-22 16:23

I am using the retrofit efficient networking library, but I am unable to handle Dynamic JSON which contains single prefix responseMessage which changes to

10条回答
  •  不要未来只要你来
    2020-11-22 17:09

    Any of your possible solutions will work. What you can also do is send the Retrofit api interface return type to response. With that response you get a body Inputstream which you can convert to a JSON Object and read as you see fit.

    Look at: http://square.github.io/retrofit/#api-declaration - under RESPONSE OBJECT TYPE

    Updated

    Retrofit 2 is out now and with it some changes to the documentation and library.

    Look at http://square.github.io/retrofit/#restadapter-configuration there are request and response body object that can be used.

提交回复
热议问题