I want to use retrofit for my webservices. I am getting a problem how can I define an object with dynamic Keys. I am trying to get data for today and tomorrow. Dates will always change.
Here is the json:
{ "2015-11-13": [ ], "2015-11-14": [ ]}
I want to use retrofit for my webservices. I am getting a problem how can I define an object with dynamic Keys. I am trying to get data for today and tomorrow. Dates will always change.
Here is the json:
{ "2015-11-13": [ ], "2015-11-14": [ ]}
If you are using GSON I guess you can declare the response as JsonObject in your call like this :
@GET("your_api_path")
Call<JsonObject> getDateData();
And then parse it when you get the response
Type mapType = new TypeToken<Map<String, List<YourModel>> >() {}.getType();
Map<String, List<YourModel>> result= gson.fromJson(jsonResponse, mapType);