Currently, when returning lists of objects, YFPY returns them as lists of dictionaries, each with a single key corresponding to the data type of the object value (so a list of Game instances is returned as a list of dictionaries, each with the single key "game", and a single value corresponding to that key that is the YFPY Game object).
The reason for the above is so that unpack_data can properly parse and cast/deserialize the JSON both returned from the Yahoo API and from saved JSON data files.
For an improved user experience and a clearer data structure hierarchy, it would be nice to instead simply return a list of YFPY Game objects. However, in order to do so a new approach to detecting the correct data type will need to be built.
Currently, when returning lists of objects, YFPY returns them as lists of dictionaries, each with a single key corresponding to the data type of the object value (so a list of Game instances is returned as a list of dictionaries, each with the single key
"game"
, and a single value corresponding to that key that is the YFPY Game object).The reason for the above is so that
unpack_data
can properly parse and cast/deserialize the JSON both returned from the Yahoo API and from saved JSON data files.For an improved user experience and a clearer data structure hierarchy, it would be nice to instead simply return a list of YFPY Game objects. However, in order to do so a new approach to detecting the correct data type will need to be built.