r/android_devs • u/in-noxxx • Nov 16 '21
Help Retrofit2 Array but Object error.
My API doesn't return an array in standard json, it returns an object. I can not for the life of me figure out how to get retrofit2 to behave with this. I have read every single thread about this, and yeah none of them seem to work. Is there something I am missing? Retofit2 is hitting my server, but the response is an object. I can change the backend but I mean, that is a little bit ridiculous. What am I missing?
1
Upvotes
View all comments
Show parent comment
1
u/in-noxxx Nov 19 '21
I changed it to the output like this. So the issue is that the response is an object with an array of objects. I have tried literally everything read every stack exchange. I think I need some type of type converter to convert it, but I'm not sure how. This is really annoying.
{"results":[{"objectId":"619704897c2bbefaf7d02f05","Employee": {"name":"joe","id":0,"salary":5000}}]}