I have this JSON from an external API which I don't have any control over that contains an undefined number of named child objets, like so:
{
// ...
"promotions": {
"5": {
"id": 5,
"name": "Promo",
"translations": {
"fr": "Promo2",
"de": "Promo2",
// ...
}
},
"6": {
"id": 6,
"name": "Promo2",
"translations": {
"fr": "Promo2",
"de": "Promo2",
// ...
}
},
// ...
}
}
I wish to convert the content of promotions into a list of Promotion objects using the Play JSON library (with the Reads combinators) but I cannot figure out how to approach this.