How to ignore the keys of dynamic response of json object in retrofit 2.0

Viewed 1887

How to ignore the keys of json which are missing for response of two different users using retrofit 2.0 and gson.

This is the json response for existing user.

{ 
   "details" :{
       "userId" : "548sdry5687rtyde346asf",
        "email: "avc@zxc.com",
        "name":{
          "first":"Jhon",
          "last": "Madan",
          "_id":"69874154sdfadg58dfa245"},
          "gender":"male",
          "location":{
              "address":"12547",
              "city":"delhi",
              "state":"Delhi"
          }
     }
}

This is the response for new user

{
    "details":{
        "userId":"1258afafg287fae23sf",
        "email": "qwea@gmail.com",
        "name":{
              "first":"Mohan",
              "last":"mehar",
              "_id":"kdg2467edfdfh356thdg"}
         }
}
3 Answers
Related