How to parse JSON array without any object in Retrofit?

我只是一个虾纸丫 提交于 2019-12-17 09:56:25

问题


I am working with Retrofit and GSON. I have a JSON response as a JSON array but I don't know how to parse it by using a model class. My response is as follows:

[
    "One",
    "Two",
    "Three",
    "Four",
    "Five",
    "Six",
    "Seven",
    "Eight"
]

回答1:


Just call in the callback a list of Strings and it should do the job...

new Callback<List<String>>().


来源:https://stackoverflow.com/questions/28628513/how-to-parse-json-array-without-any-object-in-retrofit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!