Reputation: 73
How to parse json with variable keys the root of json using retrofit.
In the retrofit class that maps the response i defined a
Map<String, DateObject>
but didn't use @SerializedName
since i don't know the key.
This is the json im trying to parse:
{
"2017-04-01": [{...}, {...}, {...}],
"2017-04-02": [{...}],
"2017-04-03": []
}
Upvotes: 0
Views: 391
Reputation: 73
so i solved it with this method in the retrofit interface:
Observable<Map<String, List<Value>>> getMap();
and no need to create a manual parser
Upvotes: 1