0

In my application I want get some data from server and show this into list (recyclerview)!
I receive data from server such as below :

 "data": {
      "id": 1812286134,
      "Cr": "85",
      "BUN": "87",
      "ALP": "75",
      "ALT": "6",
      "AST": "6",
      "Chol": "55",
      "HDL": "545",
      "LDL": "45",
      "TG": "4",
      "created_at": "2022-10-30 16:05:50",
      "updated_at": "2022-10-30 16:05:50"
    }

UPDATE :
This data may update in some time, added new items or remove items by admins

I should show all of this items into recyclerview.
I know in above json data should list but has object.
But backend developer tells me convert all of this data to list with key value!
My question is can I convert this data to list and use all of items into list ?
How can I it?

1 Answer 1

1

Try to use Map<String,String> in your Response or whatever you used.

It will be something like this.

@GET
fun getCurrency():Response<DataResponse>

data class DataResponse(
val currencies:Map<String,String>
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.