Q:

Parsing dynamic JSON to POJO with Retrofit

Hi I have json which has some dynamic field names:
{
"status": {
    "rcode": 200,
    "message": "OK"
},
"data": {
    "0": {
        "SubFranchiseID": "0",
        "OutletID": "607",
        "OutletName": "Spill "
    },
    "1": {
        "SubFranchiseID": "0",
        "OutletID": "32",
        "OutletName": "PizzaRoma"
    }
},
"hash": "b262c62ea3c8c693ad35210289a487d6963434d7"

}
"0" and "1" are dynamic String values.
From here How to parse Dynamic lists with Gson annotations?
I created my Data class as :
public class Data {

   public Map<String, Restaurant> restaurants = new HashMap<>();;

   public Map<String, Restaurant> getRestaurants() {
      return restaurants;
   }
}

But I am getting zero value when i use getRestaurants().size() in Retrofit. 
How should change my Data class ?
Edit :
My main class :
public class MyClass{

private Status status;
private Data data;
private String hash;

public Data getData() {
    return data;
}
// other getter and setters
}

Retrofit and RxJava :
RetrofitService service1 = ServiceFactory.createRetrofitService(RetrofitService.class, RetrofitService.API_ENDPOINT);
    service1.data()
            .subscribeOn(Schedulers.newThread())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Subscriber<MyClass>() {

                @Override
                public final void onNext(MyClass response) {

                    if(response.getData().getRestaurants().size() == 0)
                        Log.d("1", "size is ZERO ");

                }
            });

A:

The solution was to not use the Data class , instead I changed my MyClass as:
public class MyClass{

private Status status;

@SerializedName("data")
private Map<String, Restaurant> data;

private String hash;

public Map<String, Restaurant> getData() {
    return data;
}
// other getter and setters
}

