0

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": [  ]}
haythem souissi
  • 3,263
  • 7
  • 50
  • 77

1 Answers1

1

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);
Niko Adrianus Yuwono
  • 11,012
  • 8
  • 42
  • 64
  • Could u please help for following parsing, mentioned [here](http://stackoverflow.com/q/33758601/2624806) – CoDe Nov 17 '15 at 13:55