0

i have 2 endpoints give me Category detail. one is like below just give a list of category children:

[{
    "id": 5,
    "title": "cat1",
    "parent": 1
},
{
    "id": 4,
    "title": "cat2",
    "parent": 1
},
{
    "id": 2,
    "title": "cat3",
    "parent": 1
}]

and the other give a category object that contain its parent until root item like below:

{
    "id": 5,
    "title": "cat1",
    "parent": {
        "id": 4,
        "title": "cat2",
        "parent": {
            "id": 2,
            "title": "cat3",
            "parent": {
                "id": 1,
                "title": "cat4",
                "parent": null
            }
        }
    }
}

is it possible handle these endpoints response by one wrapper? what is best solution in this situation?

Chandela
  • 262
  • 5
  • 18
hamed
  • 148
  • 11
  • Create two different POJO classes for response .. – ADM Dec 11 '19 at 07:34
  • 1
    Does this answer your question? [Retrofit 2, same name different data type JSON Parsing](https://stackoverflow.com/questions/44171908/retrofit-2-same-name-different-data-type-json-parsing) – Yang Liu Dec 11 '19 at 08:38

0 Answers0