1

I am using Retrofit to retrieve data from server, but my json response is dynamic

Some time the Json response like

 {
           "response":"1",
           "responseMessage":{
    "0":{
              "surname":"Jhon",
              "forename":" taylor"},
    "1":{
              "surname":"Jhon",
              "forename":" taylor"},
    "total":"2"
           }

        }

Sometimes it like

 {
           "response":"1",
           "responseMessage":{
    "0":{
              "surname":"Jhon",
              "forename":" taylor"},
    "total":"1"
           }

    }

How to create model class for receive this response

Shanto George
  • 994
  • 13
  • 26
  • Did you try searching the net for a solution before asking? – nasch May 17 '17 at 19:20
  • Of course nasch, but not found a solution. Please share the solution if you have one. – Shanto George May 18 '17 at 02:36
  • 2
    Something like this could be helpful: http://veskoiliev.com/how-to-handle-dynamic-json-response-with-retrofit/ or this: http://stackoverflow.com/a/35518822/3307720 Also when asking a question, it's best to explain what research you've already done and why the results were not satisfactory. As written, your question doesn't make it clear that you've tried to find an answer already. https://stackoverflow.com/help/how-to-ask – nasch May 18 '17 at 03:00

0 Answers0